sub remove_cruft { # do stuff to single line $_[0]; } # use as: while (my $l = <$fh>) { remove_cruft($l); remove_other_cruft($l); remove_yet_more_cruft($l); # or ... $_->($l) foreach (\&remove_cruft, \&remove_other_cruft, \&remove_yet_more_cruft); }