Created
June 3, 2013 11:35
-
-
Save garethflowers/5697583 to your computer and use it in GitHub Desktop.
"inarray.pl" - checks if an array contains a `value`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub inarray | |
| { | |
| my ( $value, @array ) = @_; | |
| foreach my $arrayvalues ( @array ) | |
| { | |
| foreach my $arrayvalue ( @$arrayvalues ) | |
| { | |
| if ( $arrayvalue eq $value ) | |
| { | |
| return 1; | |
| } | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment