Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

well...

I got the feeling you were just messing around from the example. But I wanted to stress how messy it can get when you play with special variable none the less.

Yes, your first method is probably more akin to what I would do (disclaimer: jptxs only pretends to be a programmer. he is actually a philosopher with delusions of CS). But you could probably think of ten more to benchmark if you want, like print map { join "", @{$_}, "\n" } @data; comes immediately to mind. As for additional function calls, I think it comes down to the benchmarking of the thing. Sometimes less is not better if the one function you call ends up using more resources than two trimmer ones would have for the same task. Benchmark and be happy.

Your realization about using the bare @$x as opposed to the double-quoted version is correct. Neat, eh? I love it when stuff becomes clear too : ) And you can pass as many elements to print as you like. Just be sure to start using '()' after a while if you line up a bunch of functions since it can get pretty confusing.

As for which is better, I'm a little unclear on what you mean. If you mean to say your way is the first way you did it, i.e. for my $x (@data){...; I think that's fine for any list since you need to go through every element anyway. Looping through very large lists is just something that slows down as the lists grows - no way around that really. If your way is changing the $" vaiable, then I'd have to say there are better ways to go as stated. Ultimately the creed holds true - TMTOWTDI; and how you decide to do it will be based on needs, skill, function and feeling.

I think it's super-cool to play with perl to try and understand what's up - I do so as often as I can.

<myExperience> $mostLanguages = 'Designed for engineers by engineers.'; $perl = 'Designed for people who speak by a linguist.'; </myExperience>

In reply to Re: (jptxs2) Help with @LoL by jptxs
in thread Help with @LoL by zzspectrez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2023-12-06 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (31 votes). Check out past polls.

    Notices?