#! /usr/local/bin/perl -w # 1 # 2 use strict; # 3 # 4 my $foo = shift || 'ok'; # 5 my $bar; # = undef # 6 # 7 print "foo contains [$foo]\n"; # 8 if( $foo eq 'nok' ) { # 9 print "foo is nok\n"; # 10 } # 11 elsif( $bar eq 'rat' ) { # 12 print "bar is rat\n"; # 13 } # 14 else { # 15 print "nothing\n"; # 16 } # 17 #### foo contains [ok] Use of uninitialized value in string eq at ifbug line 9. nothing #### awk -F: 'substr($1,0,1)=="p" {print $3}' /etc/passwd perl -F: -lane 'substr($F[0],0,1)eq"p" and print $F[2]' /etc/passwd