Hi All,
I try this script:
#!/usr/bin/perl
use strict;
use warnings;
my $filename = @ARGV;
my $lines;
#open FILE, "fred.txt" or die "Can't open foobar.txt : $!";
open FILE, $filename or die "Can't open $filename : $!";
$lines = join '', <FILE>;
print "$lines\n\n\n\n";
$lines =~ s/^/fred.txt: /mg;
print $lines;
yet this is the result:
$ cat fred.txt
Alfred
freddy
Freddy Mercury
Wilma
wilma
fred
Freddo
freedo
Antonius Alfred
Mr. Alfred
Mr. freddy
Mrs. Freddy Mercury
Ms. Wilma
Ms. wilma
Mr. fred
Mrs. Freddo
Mr. freedo
Antonius J. Alfred
FRED
fRED
Fred
Mr. Fred and Mrs. Wilma
Fred and Wilma
Wilma Fred
fredwilma
[EMAIL PROTECTED]:~/tutorial/perl$ perl ex9-b.pl fred.txt
Can't open 1 : No such file or directory at ex9-b.pl line 10.
However, if I use open FILE, "fred.txt" or die "Can't open foobar.txt :
$!"; It works.
thx
.dave
http://www.davidsudjiman.info
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>