Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with Perl script that creates directories with names

Status
Not open for further replies.

vlsi_fanatic

Junior Member level 1
Joined
Aug 14, 2004
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
174
Help with perl

Hi,
i am new to perl. I got a problem. I am writing a script to create a
directory whose name will be generated in the script. for example one
of the directory name I need to create will be 9.1.3C I am getting
this value in a variable ($dirname) and I am using
print `mkdir C:/perl/$dirname` command to create it. Since the value
includes a Charecter perl is giving me syntax error. If the value is
just 9.1.3 the print line is working fine. But with that charecter at
the end I am getting problems. Can anyone solve my problem?

Thanks
 

Re: Help with perl

Try this one instead

Code:
system("mkdir C:/perl/$dirname");
Hope this helps!!
 

Re: Help with perl

again I am getting the same error
 

Re: Help with perl

make sure your directory name is enclosed in quotes.

$dirname = "9.1.3C";

hope this helps.
 

Re: Help with perl

have it in quotes
 

Re: Help with perl

Hi,

when I see your code, I'm really a little bit confused. Shouldn't you use back-slash instead of slash in Win directory path?

Let me know if windows changed the command line behaviour :)

BTW. If you want to create the directory structure similar you presented, try this:
Code:
system( "mkdir C:\\perl\\$dirname" );

HTH,
kovalja
 

Re: Help with perl

kovalja said:
Hi,

when I see your code, I'm really a little bit confused. Shouldn't you use back-slash instead of slash in Win directory path?

Let me know if windows changed the command line behaviour :)

BTW. If you want to create the directory structure similar you presented, try this:
Code:
system( "mkdir C:\\perl\\$dirname" );

HTH,
kovalja


Windows didn't change the command line behavior. In this way you don't need to escape the backslash in the path. Try using it. It works.

Added after 1 minutes:

jammed said:
make sure your directory name is enclosed in quotes.

$dirname = "9.1.3C";

hope this helps.


If I put it in Quotes it works.

Thanks.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top