in reply to Re: Pattern not manipulating file output
in thread Pattern not manipulating file output
This code seems to work as intended. My only remaining confusion relates to these lines of code:#!/usr/bin/perl use strict; use warnings; my $file = @ARGV[0]; if (!$file) { print "Hey! You didn't give me a file, sucka!\n"; } my $out = $file; $out =~ s/\.\w+?$/.out/; open IN, "<$file" or die "File did not open.\n"; open OUT, ">$out" or die "File not available for write.\n"; while (<IN>) { $_ =~ s/fred/\Ul\Earry/gi; }
now is the first line $out accepting the first index of @ARGV as a "file" or is it just accepting the name of the file.my $out = $file; $out =~ s/\.\w+?$/.out/;
|
|---|