Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Schwartzian Transform and memory allocation.

by Aristotle (Chancellor)
on Jun 19, 2002 at 19:21 UTC ( #175812=note: print w/ replies, xml ) Need Help??


in reply to Re: Schwartzian Transform and memory allocation.
in thread Schwartzian Transform and memory allocation.

Why split once for the Schwartzian Transform then again for the output?

open FILE, "<$data_file"; my @file_data = sort { $a->[$variable-1] cmp $b->[$variable-1] }, map [ split(/\|/) ], <FILE>; close FILE; print qq(<TABLE BORDER="1">); for my $row (@file_data){ print ( qq(<TR>), map(qq(<TD>$_</TD>), @$row), qq(</TR>) ); } print qq(</TABLE>);
____________
Makeshifts last the longest.


Comment on Re^2: Schwartzian Transform and memory allocation.
Download Code
Re^3: Schwartzian Transform and memory allocation.
by flounder99 (Friar) on Jun 20, 2002 at 13:41 UTC
    I think the

    sort { $a->[$variable-1] cmp $b->[$variable-1] },

    line should be

    sort { $a->[$variable] cmp $b->[$variable] },

    The -1 was added by abigail to skip over the $_ that was tacked on at the beginning of the anon array. You're no longer doing that.

    --

    flounder

      No, actually, Abigail added the -1 because there was no longer an extra element to skip over. It doesn't make sense to subtract 1 to skip over an extra element, does it? The same premise holds true in my snippet as well.

      Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://175812]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2014-07-28 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (197 votes), past polls