
abhijith321
New User
Aug 29, 2010, 8:38 PM
Post #1 of 3
(9106 views)
|
Parsing of string
|
Can't Post
|
|
Hi I need help My input is AB1234567DF345CF453 I need output to be print as AB1234567 DF345 CF453 i.e I need to split the string whenever i get 2 alphabets I wrote the program using split function #!/usr/bin/perl my $data='AB1234567DF345CF453'; my @values = split(/([A-Z][A-Z][1-8]*)/, $data); chomp(@values); foreach my $val(@values) { print "$val\n"; } But i getting output as <New Line> AB1234567 <New Line> <New Line> DF345 <New Line> <New Line> CF453 <New Line> I need the desired output without new lines AB1234567 DF345 CF453 If i use period in the print state i.e print "val." the output is .AB1234567..DF345.CF453 Any help is highly appreciated.
|