
KevinR
Veteran

Jul 28, 2009, 10:41 AM
Views: 16893
|
Re: [masaniparesh] Need help in tab separator string
|
|
|
If you want to test if a string has only one tab, don't use a regexp, use the tr operator (It looks like a regexp but its not):
@array = ("test with one tab\t test", "test with two tabs\t\ttest"); for (@array) { if (1 == tr/\t/\t/) { print "[$_ ] There is only one tab\n"; } else { print "[$_] There is more than one tab\n"; } } -------------------------------------------------
(This post was edited by KevinR on Jul 28, 2009, 10:41 AM)
|