Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: Newbie question

by jdporter (Chancellor)
on Aug 24, 2022 at 13:24 UTC ( #11146363=note: print w/replies, xml ) Need Help??

in reply to Re: Newbie question
in thread Newbie question

Don't push when you can print.

I'm sorry, this is not good advice. It creates a "strong coupling" between the logic of the algorithm and the interface/caller. It may be that you decide later that you want to send the results somewhere else, or do further processing on them before outputting. Do you really want to dive into the algorithm and find all the print statements? You'll just be converting them to push'es anyway. Better advice is to have your algorithm build its results in a data structure; have a separate routine for outputting that data.

Replies are listed 'Best First'.
Re^3: Newbie question
by oldB51 (Sexton) on Aug 24, 2022 at 13:35 UTC

    Thank you for this jdporter.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2023-02-01 12:29 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (0 votes). Check out past polls.