Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to pass a file to GetOpt

by onelesd (Pilgrim)
on Jul 10, 2012 at 21:58 UTC ( #980958=note: print w/replies, xml ) Need Help??


in reply to How to pass a file to GetOpt

Are you using linux?

perl -e 'while (<>) {chomp;print "=>$_<\n";}' < infile > outfile

Replies are listed 'Best First'.
Re^2: How to pass a file to GetOpt
by Anonymous Monk on Jul 10, 2012 at 22:01 UTC

    Sorry, forgot to clarify, I am using Windows command prompt. I am looking for how to do this in the code. For example:

    while ($input){

    Only that doesn't work.

      # usage: # script.pl /path/to/infile /path/to/outfile die "infile not defined\n" if (! defined $ARGV[0]) ; die "outfile not defined\n" if (! defined $ARGV[1]) ; open my $infile, "< $ARGV[0]" or die "can't read $ARGV[0]\n" ; open my $outfile, "> $ARGV[1]" or die "can't write $ARGV[1]\n" ; while (<$infile>) { chomp ; print $outfile "=>$_<\n" ; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2023-09-27 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?