Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: iterative foreach loop

by hippo (Bishop)
on Nov 15, 2017 at 11:29 UTC ( [id://1203462]=note: print w/replies, xml ) Need Help??


in reply to Re: iterative foreach loop
in thread iterative foreach loop

for my $newline (@lines) { printf $newline; # print the contents of the filled array }

This seems confusingly verbose to me. Why not simply

print @lines;

There's no need for printf, for an explicit loop or for a lexical scalar. TIMTOWTDI, but there is clarity in simplicity.

Replies are listed 'Best First'.
Re^3: iterative foreach loop
by zarath (Beadle) on Nov 15, 2017 at 11:38 UTC

    Good points, thanks for that!

    I think I picked up some bad habits by learning Perl mainly from some old scripts I've come across at work.

    Starting to think the guy who wrote them shouldn't have...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-24 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found