[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] match "/" at end of string ???



>here's an easy one...
>
>
>what is the best way to to check if string has  a "/" at the end?
>
>$slashdirpath = "images/porsches/my911s/";
>
>if ($slashdirpath =~ /$\//) {
>   print "slash path does have a slash after it\n";
>} else {
>    print "slash path does NOT have a slash after it\n";
>}
>
>this does not work...please help!!!

if ($slashpath =~ /\/$/)  {

You just had the $ in the wrong place.



#================================================================
perl -e 'srand();if(rand>.5){$i=0;foreach(@ARGV){@$i=split(//);$z
[$i]=0;foreach$l(@$i){$s[$i][$z[$i]]=$l;$z[$i]++;}$i++;}foreach$m
(@s){foreach$g(@{$m}){print$g}print" ";$m++}}else{print(join(" ",
@ARGV))}print"\n"' McClellan Clan Motto: Think On

Chris Nandor                                       pudge@pcix.com
PGP Key 0xB76E72AD                    http://pudge.petersons.com/