in reply to Re^2: Can anyone pls tell me how to cleanup this in Perl.
in thread Can anyone pls tel me how to cleanup this in Perl.

If the data has already been read into the variable $data as a single string, then just replace the line:

if (my ($field) = grep { /^!!./ } split /\|/, do { local $/; <DATA> })

with:

if (my ($field) = grep { /^!!./ } split /\|/, $data)

(The expression do { local $/; <DATA> } slurps the whole of the data in from the __DATA__ block at the foot of the script.)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^4: Can anyone pls tell me how to cleanup this in Perl.
by Anonymous Monk on Mar 19, 2013 at 06:41 UTC
    Wow, Cool. That works. Thanks a lot Mr. Athanasius :)