Subroutine parameters problem
Hello i was trying to make subroutine to print names of people to have less of writting but this doesnt work and i dont know which parameters i should use i was trying everything which come to my brain. If somebody can look at it and tell me what parameters should be inside function i would be thankful. Here is codeelsif($winners eq "denmark\n") { print "Denmark - people at competition:\n"; foreach $guest(@people) { if(length($guest->{'id'}) == 15 && $guest->{'id'} =~ /^20[ +0-5]|^26|^28/) { &write(#dont know what parameters should give) } } } # My function sub write { print "$guest->{'surname'} "; print "$guest->{'name'}"; print ":$guest->{'id'}\n"; } If i do it like this it works without problem elsif($winners eq "denmark\n") { print "Denmark - people at competition:\n"; foreach $guest(@people) { if(length($guest->{'id'}) == 15 && $guest->{'id'} =~ /^20[ +0-5]|^26|^28/) { print "$guest->{'surname'} "; print "$guest->{'name'}"; print ":$guest->{'id'}\n"; } } }
In reply to Problem with parameters in subroutines by aatrox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |