yueli711 has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I want to print ""dino". Thank you in advance!
my @array = qw /fred barney betty dino wilma pebbles bamm-bamn/; my $result=&which_element_is("dino", names); sub which_element_is{ my($what, @array)=@_; foreach (0..$#array){ if($what eq $array[$_]){ print "$_\n"; return $_; } } print "99\n"; -1 } print "$result\n"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print problem
by hippo (Archbishop) on May 08, 2018 at 13:24 UTC | |
by yueli711 (Sexton) on May 08, 2018 at 13:53 UTC | |
|
Re: print problem
by thanos1983 (Parson) on May 08, 2018 at 13:58 UTC |