Re: Need help with a question.




"Trev" wrote:

Thanks, I've made the changes and so far so good.

foreach $cpqlog (@cpqlog_data) {
{
chomp($cpqlog);

if ($cpqlog =~ /MAC/) {
$cpqlog =~ s/ <FIELD NAME="Subject" VALUE="//i;
$cpqlog =~ s/ <FIELD NAME="MAC" VALUE="//i;
$cpqlog =~ s/"\/>//i;
}
}
}

You do understand that the above code does not actually change anything in
the file, right? The substitutions in $cpqlog are just discarded at the end
of the loop.

Oh, and you might want to get rid of the superfluous { }'s...




.



Relevant Pages

  • Re: Need help with a question.
    ... The substitutions in $cpqlog are just discarded at the end of the loop. ... You'd still have to write that array back to the file if that's the ... intent. ... foreach my $cpqlog ...
    (comp.lang.perl.misc)
  • Re: Need help with a question.
    ... foreach $cpqlog { ...     chomp; ... The substitutions in $cpqlog are just discarded at the end ...
    (comp.lang.perl.misc)
  • Re: Need help with a question.
    ... foreach $cpqlog { ... The substitutions in $cpqlog are just discarded at the end ... the loop variable $cpqlog is an "alias" to the ... array elements, so the changes to $cpqlog are applied to the members of ...
    (comp.lang.perl.misc)