Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
more useful options
 
PerlMonks  

Re: Re: Short (and clever?) CSV-to-AoA

by scott (Chaplain)
on Apr 23, 2001 at 20:21 UTC ( [id://74859]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Short (and clever?) CSV-to-AoA
in thread Short (and clever?) CSV-to-AoA

1. You assign to an array in a for loop. That usually is a sign for something inefficient.

It seemed more 'cool' to me than inefficient. I particularly liked the fact that I could get away with only one synthetic variable and that a loop counter (of sorts). Why is it inefficient?

2. Your use of $#i will put all data in one array, so you technically don't have an AoA, but just an array.

Errr ... but it *does* produce an AoA.

print join( ', ' , @AoA ) , "\n";
Gives
ARRAY(0x1b9528c), ARRAY(0x1b952a4), ARRAY(0x1b952d4)

3. You can loose the push/pop mechanism ...

See my comment to merlyn.

Replies are listed 'Best First'.
Re:{3} Short (and clever?) CSV-to-AoA
by jeroenes (Priest) on Apr 24, 2001 at 05:10 UTC
    Mea culpa, I clearly missed the fact that you were transposing the table. But the other things stay.


    1. Assigning in a for loop is something that goes automagically. If there is the need to assign to an array in something that already works on an array, that should ring a bell that something is inefficient there. Your for loop actually is an assignment and a conditional statement.That maybe nice for obfuscation (well, not really, but a bit maybe), but not cool IMHO.


    3. As merlyn responded, you can rewrite that to a map, too.

    Jeroen
    "We are not alone"(FZ)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://74859]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.