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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.