
Zhris
Enthusiast
Dec 13, 2010, 4:40 AM
Post #3 of 4
(1479 views)
|
Re: [amindlessbrain] Reading in a tab delim file as an array of arrays but issues with boolean
[In reply to]
|
Can't Post
|
|
Hi, In Perl, when comparing numbers you would use i.e. "==", but when comparing strings you would use i.e. "eq". Therefore I believe "eq" would have worked in your case. The regular expression you are using won't neccessarily find an exact match. For example:
my $var1 = "mystring"; my $var2 = "string"; if ($var1 =~ m/$var2/) {print "True!";} else {print "False!";} Although var1 and var2 aren't the same, the regular expression will return true because var2 is contained within var1. A better regular expression would be: ^, $ signal the beginning and the end of the "row of data". \Q and \E are simply there so that the $ in $var2 isn't regarded as a special character. Chris
(This post was edited by Zhris on Dec 13, 2010, 4:44 AM)
|