On Tue, 6 Dec 2005, John W. Krahn wrote:
> Because the null filehandle inside the readline operator ( <> ) has special
> magic which works together with the @ARGV array and the $^I scalar but does
> not work with ordinary filehandles.
>
> See the "I/O Operators" section of perlop.pod for an explan
David Sudjiman wrote:
> This is my script.
>
> ===
> #!/usr/bin/perl
> # ex9-2b.pl
>
> use strict;
> use warnings;
>
> my ($filename) = @ARGV;
>
> open FILE, $filename or die "Can't open $filename : $!";
>
> $^I = ".out";
> while () {
>s/Fred/Larry/i;
>print;
> }
> ===
>
> I execut
This is my script.
===
#!/usr/bin/perl
# ex9-2b.pl
use strict;
use warnings;
my ($filename) = @ARGV;
open FILE, $filename or die "Can't open $filename : $!";
$^I = ".out";
while () {
s/Fred/Larry/i;
print;
}
===
I executed using:
$ perl ex9-2b.pl fred_larry.txt
AlLarry
Larrydy
Larryd