Hi,
Why my code below fail to open and
print the file contents

when I do:

perl mycode.pl -f filename

Regards,
Edward WIJAYA
SINGAPORE

__BEGIN__
use strict;
use warnings;

use Getopt::Std;
use vars qw($f);
getopts('f:');

my      $f = $ARGV[0];
open ( INFILE, '<', $f)
    or die "$0 : failed to open input file $f : $!\n";
close ( INFILE );                       


while ( <> ) { print $_; } __END__

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to