in reply to print if warn
I think that you are asking how to test for definedness
#!/usr/bin/perl -w use strict; my @a = qw(1 2 3); for (@a){ if ( not defined ($a[$_])){ print "\$a[$_] can't match because it's not initialized\n" unless $a[$_] =~ m/3/; print "\$a[$_] can't be tested for equivalence because it's not initialized\n" unless $a[$_] == 3; } }
|
|---|