my (@a, @b);
# . . .
# initialize variables
# . . .
my @m = map { my $x = $_; grep { /^$x$/ } @b; } @a;
print @m;
####
my (@registered_users, @personalized_users);
# . . .
# initialize variables
# . . .
my @advanced_users = map {
my $registered_user = $_;
grep { /^$registered_user$/ } @personalized_users;
} @registered_users;
##
##
my @employees; # declare an array.
my %records; # declare a hash variable.
my $name; # declare a scalar
##
##
# reference to an array
my @employees;
my $employees_aref = \@employees;
# reference to a hash
my %records;
my $records_href = \%records.
# reference to a scalar
my $huge_text;
my $huge_text_sref = \$huge_text;
# This naming is popular in subroutine parameters.
sub calc_employee_salary {
my ($employee_aref) = @_;
# $employee_aref is a reference to an array
# holding employee IDs (or names, whichever)
# since this is an array reference, use ‘@’ to get to the
# actual array.
foreach (@$employee_aref) {
# . . .
}
}
##
##
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+)-.*)$/;
$_= "," $2 ;`@$_`?{print"+ $1"}:{print"- $1"}&&`rm $1`;
print$\;}