!/usr/bin/perl -l use strict; use warnings; sub foo { # ... $_ = undef; } while () { chomp; if (/^FOO/) { foo(); print "found $_"; } if (/^BAR/) { # ... print "found $_"; } # ... } __DATA__ FOO BAR #### Use of uninitialized value in concatenation (.) or string at ./828268.pl line 14, line 1. found Use of uninitialized value in pattern match (m//) at ./828268.pl line 16, line 1. found BAR #### sub foo { # ... local $_ = "whatever"; $_ = undef; } #### found FOO found BAR