my $data; $data .= $_ while (<>); my @code = split(/[;\/]/, $data); for my $line (@code) { ... }