Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Manually incrementing @ array during for

by AnomalousMonk (Bishop)
on Mar 17, 2020 at 15:11 UTC ( #11114390=note: print w/replies, xml ) Need Help??


in reply to Re: Manually incrementing @ array during for
in thread Manually incrementing @ array during for

Is there a reason you're not just processing the lines as you read them from the file?

According to this, the code for which cniggeler is responsible "... is part of a much bigger body of code, and I receive the already created @array, ... the @array may be used elsewhere." Then IIUC, it's not possible for cniggeler to parse the data at the point of access (which I agree would likely be simpler and more efficient).


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: Manually incrementing @ array during for
by kcott (Bishop) on Mar 17, 2020 at 20:54 UTC

    Fair enough. I obviously missed the later post where the goal posts were moved. :-)

    The second of my two solutions would work equally well for an array. The chomp may not be necessary: hard to tell as the example input data presented in the OP looks more file data than array data.

    — Ken

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2020-05-31 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (173 votes). Check out past polls.

    Notices?