CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [masaniparesh] Need help in tab separator string: Edit Log



KevinR
Veteran


Jul 28, 2009, 10:41 AM


Views: 7512
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):


Code
@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)


Edit Log:
Post edited by KevinR (Veteran) on Jul 28, 2009, 10:41 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives