At the moment I am reading lines from a file, chomp them, and replace tabs by spaces, like so:
open( my $xpfh, '<', $xpathfile ) or die "cannot open file $xpathfile";
chomp( my @xplines = <$xpfh> );
close $xpfh;
foreach my $xpline (@xplines) {
$xpline =~ s/\t/ /g;
...
As you can see, chomping happens outside the foreach loop, but substitution occurs each iteration. How would one bring that action outside the foreach loop, closer to the chomping? I am asking because I would assume that this is faster than each iteration run a regular expression. Either way, it would be syntactically more pleasing to have all structural operations happen in the same block.
chompinto that loop too instead.