I have the following Perl code, which works without any error. I am wondering if it is possible to make the four replacements in the foreach loop in one pass and delete the whole line matching the fifth replacement. I do not understand the suggested solutions I have gone through so far, I am trying to avoid using hashes. I will be most appreciative.
#!/usr/bin/perl -w
use strict;
use warnings;
my @data=<DATA>;
foreach $lines (@data){
$lines =~ s/\//9/g;
$lines =~ s/333/33300/g;
$lines =~ s/555/55500/g;
$lines =~ s/=|==//g;
$lines =~ s/NIL|N I L//g; # preferably delete this whole line
}
print "@lines\n";
exit 0;
__DATA__
63740 32575 40606 10217 20159 48528 83230 333 20/// 59008 83820=
63820 32580 20803 10305 20225 40130 82200 333 20262 59009 82823==
63135 NIL=
63742 12570 10507 10208 20148 48509 60014 81100 333 20155 59012 81820=