defined #same as defined($_)
print #same as print STDOUT $_
/\sjackson$/ #same as $_ =~ /\sjackson$/
####
@only_defined = grep { defined($_) } @somearray;
%hash_defined = map { $_ => 1 } @only_defined;
#and since $_ is the default argument, you can also write
@only_defined = grep { defined } @somearray;
@only_begins_with_a = grep { /^a/ } @somearray;
####
while () {
chomp # same as chomp $_
if (/^#/) {....} # same as if ($_ =~ /^#/) { ....}
}
####
#Note this code still won't work - see sherm's explanation below.
foreach my $name (@myNames)
{
if($name =~ "jackson")
print $name . "\n"; #sic - should be { print $name . "\n" }
}
####
while (my $line = ) {
chomp $line;
if ($line =~ /^#/) {....}
}