On Fri, 1 Jul 2005, Moon, John wrote: > The following is not returning what I had expected... > > $a = q{/var/run}; > $home = q{/var/ru}; > print "Yes - $a like $home\n" if $a =~ /^$home/; > > I would have "assumed" that /var/run would NOT be "like" /var/ru just > as /var/run is not "like" /var/ra...
It depends what you mean by "like". In this case, the string in $home also appears as part of $a, so in that sense there are "alike", and the code is doing the right thing. If you want to verify that $a and $home are identical, it would be easier to just check if one `eq` the other, as print "Yes - $a like $home\n" if $a eq $home; That test will work if $home is '/var/run', but will fail on '/var/ru'. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>