Hi, > Hi Tim, > > Thanks, i tried to run the code, but get the error as below. Any thing i am > missing line 17.
What version of Perl are you using? For smart matching to work you must have Perl 5.10.1 Up (the 5.10.0 version behaved differently). > syntax error at ./match2.pl line 17, near "$match_value ~" > Execution of ./match2.pl aborted due to compilation errors. > > more match2.pl > #!/usr/bin/perl > > use warnings; > use strict; > > my @names = qw(abc def ghi jky); > > my %stud = ( > abc => "34", > nba => "99", > def => "24", > ghi => "33", > ); > > foreach my $match_value ( sort keys %stud ) { > print $match_value, "=", $stud{$match_value}, > $/ if $match_value ~~ @names; > } > > >> -- >> Tim >> > -- Tim -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/