satishchandra has asked for the wisdom of the Perl Monks concerning the following question:
for eg: if this is my line <head><to>tove</to></head> i got the position of each matched pattern now if i want only tove to be printed how can i do with substr()
while($line = <MYFILE>){ if($line =~ m/<.[^>]*>/g){ $new = substr($line,0,10); print "THE NEW LINE is : $new\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use of substr() with file
by Khen1950fx (Canon) on Feb 18, 2011 at 20:25 UTC | |
|
Re: use of substr() with file
by umasuresh (Hermit) on Feb 18, 2011 at 20:26 UTC | |
by ikegami (Patriarch) on Feb 18, 2011 at 20:31 UTC | |
by ww (Archbishop) on Feb 18, 2011 at 22:04 UTC |