Mega Code Archive

 
Categories / Perl / String
 

Find a word after splitting a string

#!/usr/bin/perl -w use strict; my $found = 0; $_ = "A aA AaA aAa AA aa... '"; my $sought = "aA"; foreach my $word (split) {     if ($word eq $sought) {         $found = 1;         last;     } } if ($found) {     print "found\n"; }