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