my $filename = shift; if ($line = /something/) { } foreach (@arr) { if (/abc/) { print; } } sub foo { my $x = shift; }