unless (open (USERNAME, "username")) { print "ERROR:Cannot open username file.\n"; exit(1); # ERROR }
Just a parenthetic note: The code quoted above is more idiomatically (and, IMHO, better) written as below, which uses both a lexical filehandle and the three-argument form of open. (See also perlopentut.)
my $filename = 'foo'; open my $filehandle, '<', $filename or die "opening '$filename': $!";
In reply to Re: Accessing a file from the perl
by AnomalousMonk
in thread Accessing a file from the perl
by abcdefg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |