You can try this:
while (<DATA>)
{
my @array = ( /(\w{3}\_\d{3}) \s
(.{4}) \s
(.{9}) \s
(.{4}) \s{6}
(.{12}) \s
(.{29}) \s
(.*$)
/x );
@array = map {s/^\s*|\s*$//g;$_} @array;
for (0..6)
{
print "\$array[\$_] = \"$array[$_]\"\n";
}
print "\n";
}
__DATA__
ABC_011 0311 0311 Pat Asc FirstName LastName MiddleName
ABCAHS: no City present, City Required...
ABC_010 V9D2 0310 0311 Requires FirstName MiddleName
SANAH 3.0x- 55+ User Fields UI- : no feature.
ABC_000 0903 9.0a1 0903 Pat Asc FirstName LastName
blah blah blah Series Timeframe max
ABC_579 0903 0303_AB99 0311 Cat Dog LastName MiddleName
Serivce Summarisation not option sorting by Date.
ABC_707 0903 0311
SRFDSA0142\\///SS:NullPointerException:mark incomplete
ABC_707 0903
SRFDSA0142\\///SS:NullPointerException:mark incomplete
On 8/11/07, Negi, Sushil (MED US) <[EMAIL PROTECTED]> wrote:
>
> Hi guys,
>
> I need some help in splitting the strings from the attached file (or below
> data). The attached file also contains the example output arrays. I am
> probably done with looking at this since morning. Any help will be greatly
> appreciated.
>
>
> -------------------------------------------------------------------
> Pattern to be Parsed is below
>
> ABC_011 0311 0311 Pat Asc FirstName LastName
> MiddleName ABCAHS: no City present, City Required...
> ABC_010 V9D2 0310 0311 Requires FirstName
> MiddleName SANAH 3.0x- 55+ User Fields UI- : no feature.
> ABC_000 0903 9.0a1 0903 Pat Asc FirstName
> LastName blah blah blah Series Timeframe max
> ABC_579 0903 0303_AB99 0311 Cat Dog LastName
> MiddleName Serivce Summarisation not option sorting by Date.
> ABC_707 0903
> 0311
> SRFDSA0142\\///SS:NullPointerException:mark incomplete
> ABC_707
> 0903
> SRFDSA0142\\///SS:NullPointerException:mark incomplete
>
> Below is the expected results
> from
> ABC_011 0311 0311 Pat Asc FirstName LastName
> MiddleName ABCAHS: no City present, City Required...
>
> @array [0]="ABC_011"
> @array [1]="0311"
> @array [2]=""
> @array [3]="0311"
> @array [4]="Pat Asc"
> @array [5]="FirstName LastName MiddleName"
> @array [6]="ABCAHS: no City present, City Required..."
>
>
> from
> ABC_000 0903 9.0a1 0903 Pat Asc FirstName
> LastName blah blah blah Series Timeframe max
>
> @array [0]="ABC_000"
> @array [1]="0903"
> @array [2]="9.0a1"
> @array [3]="0903"
> @array [4]="Pat Asc"
> @array [5]="FirstName LastName"
> @array [6]="blah blah blah Series Timeframe max"
>
>
> from
> ABC_579 0903 0303_AB99 0311 Cat Dog LastName
> MiddleName Serivce Summarisation not option sorting by Date.
>
> @array [0]="ABC_579"
> @array [1]="0903"
> @array [2]="0303_AB99"
> @array [3]="0311"
> @array [4]="Cat Dog"
> @array [5]="LastName MiddleName"
> @array [6]="Serivce Summarisation not option sorting by Date."
>
>
> Thanks
> Sushil
>
>
> ----------------------------------------------------------------------------
> This message and any included attachments are from Siemens Medical
> Solutions
> and are intended only for the addressee(s).
> The information contained herein may include trade secrets or privileged
> or
> otherwise confidential information. Unauthorized review, forwarding,
> printing,
> copying, distributing, or using such information is strictly prohibited
> and may
> be unlawful. If you received this message in error, or have reason to
> believe
> you are not authorized to receive it, please promptly delete this message
> and
> notify the sender by e-mail with a copy to
> [EMAIL PROTECTED]
>
> Thank you
>
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> <http://listserv.activestate.com/mailman/mysubs>
>
>
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs