Miguel Santinho wrote:
>
> On Wed, 10 Nov 2004 00:04:12 -0600
> "Charles K. Clarkson" <[EMAIL PROTECTED]> wrote:
>
> > my @headers = split ' ', <DATA>;
>
> This way, if tomorrow you have some data like:
>
> extents nptot
> 5 1671035
> 2223412520365
>
> you'll be in troubles, right?
>
[ ... snip ... ]
For a generic app this risk is there, and maybe
substr is a save way to go, TMMV it depends
heavily on output processing/formation of the
predecessor in the pipeline.
But for the context in which I use the script
there is a maximum for the values of each
column.
In my original posting the __DATA__ section
is from live output, only object names are
made neutral via script.
Sorry that the lines wrapped ...
> my @tables;
> while (<DATA>) {
> my %table;
> @table{ @headers } = split;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
I love this part! Looks like magic to me :-)
Indeed, this is a fascinating functionality of Perl!
I found it reading up about hash slices and array slices,
see the commented lines labelled xmpl in my original posting
dic_k
--
Richard Kofler
SOLID STATE EDV
Dienstleistungen GmbH
Vienna/Austria/Europe
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>