use strict; use warnings; my $sampleData = < 'wibble'}; my $str; while (<$sitelist>) { chomp; if (/\Q$Session->{'usrSystem'}\E/) { print "New stuff for $_\n"; } else { print "Something else for $_\n"; } } #### Something else for This and that New stuff for wibble Something else for the other