Shotoku Taishi wrote:
[...]
> foreach $a (@a) {
> print OUTPUT <<EOT;
> file=$a log=$a\.log
> EOT
> }
[...]
> I have tried
> s/\.exp\./\./g;
> but the output does not seem to change.
>
> How do I apply the search and replace routine so that it works?
Need to apply your substitution on something, using =~, otherwise it
only operates on $_.
foreach my $a (@a)
{
my $log = $a;
$log =~ s/\.exp\./\./;
print OUTPUT "file=$a log=$log.log\n";
}
foreach (@a)
{
print OUTPUT "file=$_ ";
s/\.exp\./\./; # $_ is operated on
print OUTPUT "log=$_.log\n";
}
|