Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: system command is not working

by gulla (Initiate)
on Dec 09, 2011 at 03:33 UTC ( #942553=note: print w/replies, xml ) Need Help??


in reply to Re^3: system command is not working
in thread system command is not working

I do agree with you that the error is reported by /bin/sh not the perl. The perl script has just two lines; first line is

 #!/usr/bin/perl

and second line is

 system('ls -lrt > c.out');

Thanks, Anand

Replies are listed 'Best First'.
Re^5: system command is not working
by jffry (Hermit) on Dec 09, 2011 at 18:30 UTC

    The first two bytes of the file must be the characters #! You can not just have a few blank lines above your #!/usr/bin/perl line.

    This is a shell script (with line numbers showing), not a Perl script:

    1 2 #!/usr/bin/perl 3 4 echo This is really a shell script!

    If the first two bytes of the file are not #! then the system default shell will interpret the commands in the file. Thus, your error.

    Seriously, dude, you need to learn the basics of your Unix shell.

Re^5: system command is not working
by Anonymous Monk on Dec 09, 2011 at 04:58 UTC

    dos2unix

    #!/usr/bin/perl  --

    #!/usr/bin/perl -w  --

    Seriously, read the FAQs linked

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942553]
help
Chatterbox?
[Eily]: it doesn't work in French AFAIK
[Eily]: I like the first one though :)
[erix]: balloonist, surely :P (or maybe baloneyist)
[marto]: afternoon all
[Corion]: Hi marto ;)
[Corion]: Eily: Yeah - my French isn't even good to understand jokes, much less to make them :-D
[Corion]: marto: That post is a repost/duplicate of Excel sheet data write issue :-D

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-09-21 14:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (248 votes). Check out past polls.

    Notices?