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
 

nand_gates

Advanced Member level 3
Joined
Jul 19, 2004
Messages
893
Helped
175
Reputation
350
Reaction score
51
Trophy points
1,308
Activity points
6,843
Re: Help with perl

Try this one instead

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

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
Re: Help with perl

again I am getting the same error
 

jammed

Newbie level 3
Joined
Sep 30, 2005
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,322
Re: Help with perl

make sure your directory name is enclosed in quotes.

$dirname = "9.1.3C";

hope this helps.
 

disney

Member level 1
Joined
Sep 20, 2005
Messages
37
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,588
Re: Help with perl

have it in quotes
 

kovalja

Junior Member level 2
Joined
Jul 18, 2002
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
126
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
 

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
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

Top