hi,

#!/usr/bin/perl
use strict;
use warnings;

my $file;
my @xfiles;

@xfiles = ("canada", "cane", "cane02", "ca.e.02", "canine",
".hidden");

foreach $file (@xfiles){

#want canada only for this iteration
        if ($file =~ /(canada)/){print "$file\n  - end first if -  \n";}

#wb: (expression) groups what you want to find - ie dont search for c,a,n,d...
but for the whole word "canada" , no next required since if you match
canada, elsif wil not be executed (thats what else means, right?)

#then want cane, canine, ca.e.02
elsif ($file =~ /(^cane$)|(canine)|(ca.e.02)/){ print "$file\n"; }
  }

#wb: same as above, | lists alternatives, ie either "cane" or "canine" or ..
^ matches beginning of word, $ matches end



Cheers, Wolf


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to