Brian wrote:
Brian wrote:
John W. Krahn wrote:
Brian wrote:
Hi
Hello,
<snip>
#!/usr/bin/perl
use warnings;
use strict;
@ARGV == 3 or die "usage: $0 <search for> <replace with> <date>\n";
my ( $search, $replace, $date ) = @ARGV;
my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ];
my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $year + 1900;
( $^I, @ARGV ) = ( '', 'dummy.txt' );
Oops 2!
I changed ( $^I, @ARGV ) = ( '', 'dummy.txt' );
to ( $^I, @ARGV ) = ( '.bak', 'dummy.txt' );
that got rid of the error, created a copy of dummy.txt to dummy.txt.bak
but failed to make the desired changes to dummy.txt
1 question though, while I understand why $year is + 1900, why is $mon +1 ?
Brian
Partial success.
The value <search for> is normally located starting at the 35th char
into the line.
I split the line so it was at the beginning of a new line and <replace
with> worked.
Unfortunately the dates never changed.
I will sleep on this and attack it again in the morning.
Brian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/