Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: System command not working

by aitap (Curate)
on Jul 10, 2012 at 07:19 UTC ( [id://980830]=note: print w/replies, xml ) Need Help??


in reply to Re^2: System command not working
in thread System command not working

You can add -n to the first line of your script and set all needed variables in the BEGIN{} block (which is not looped like all other code when using -n):
#!/usr/bin/perl -wn BEGIN{ use strict; my $outFile= "output.txt"; my $inFile= "infile.txt"; $main::start=17; # 'my' in this scope will result in uninitialized va +lues outside the BEGIN{} block $main::end=30; close STDOUT; close STDIN; open STDIN,"<",$inFile || die $!; open STDOUT,">",$outFile || die $!; } print if $. >= $start && $. <= $end;
Sorry if my advice was wrong.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://980830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-24 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found