Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by haukex (Canon)
on Feb 13, 2019 at 18:46 UTC ( #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
Node Status?
node history
Node Type: note [id://1229883]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2019-03-18 17:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (85 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!