<>Ted wrote:
<>while (<FILEFROM>) {
chomp;
if ($_ =~/\d\s[A-Z]{3}\s/) {
$_ = s/$1/$1\t/g;
}
print FILETO "$_\n";
}
You were close Ted but there are a couple problems.
1. $_ = s/$1/$1\t/g; should be $_ =~ s/$1/$1\t/g; (you left out the ~)
2. $1 isn't defined anywhere in this code since there are no paren's in the
first REGEX.
Try this (similar to what Artemave posted);
while (<FILEFROM>) {
chomp;
$_ =~ s/(\d\s[A-Z]{3}\s)/$1\t/;
print FILETO $_;
}
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs