Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Adding text file data to hashes and array

by haukex (Archbishop)
on Feb 13, 2019 at 18:46 UTC ( [id://1229883]=note: print w/replies, xml ) Need Help??


in reply to Re: Adding text file data to hashes and array
in thread Adding text file data to hashes and array

Two nits: Why use splice @lines, 0, 1; instead of shift, and why use split /\s+/ when split ' ' does the same thing but discards leading whitespace? splice @elements, 0, 1; discards the first element regardless of what it contains, even if the file format changes and there is no more whitespace at the front of the lines.

Replies are listed 'Best First'.
Re^3: Adding text file data to hashes and array
by thanos1983 (Parson) on Feb 18, 2019 at 11:45 UTC

    Hello haukex,

    Yes you are right, I was not thinking clearly on that day and I made the code more complex without any reason :).

    Thanks for pointing out minor possible improvements.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-18 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found