It's often useful to see what's actually in a structure like an array or hash:
c:\@Work\Perl\monks>perl -wMstrict -le
"use Data::Dump qw(pp);
;;
my @foo;
my $bar;
;;
$bar = 42; push @foo, $bar; print 'A: ', pp(@foo);
$bar = 'abc' =~ /abc/; push @foo, $bar; print 'B: ', pp(@foo);
$bar = 'abc' =~ /abcd/; push @foo, $bar; print 'C: ', pp(@foo);
$bar = ''; push @foo, $bar; print 'D: ', pp(@foo);
$bar = 0; push @foo, $bar; print 'E: ', pp(@foo);
$bar = undef; push @foo, $bar; print 'F: ', pp(@foo);
push @foo, (); print 'G: ', pp(@foo);
"
A: 42
B: (42, 1)
C: (42, 1, "")
D: (42, 1, "", "")
E: (42, 1, "", "", 0)
F: (42, 1, "", "", 0, undef)
G: (42, 1, "", "", 0, undef)
See
Data::Dump, which is not core, or
Data::Dumper, which is.
Give a man a fish: <%-{-{-{-<