Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

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

I didnt think of doing it that way. Thanks, that is another way. I agree. Messing with the special variables is not the best way to do it. However, I was looking for the example of what caused the introduction of the spaces when the list was printed within double quotes. Modifying $" was just for verification that it would prevent it. It was more of understanding why perl was reacting the way it was in that case then best way to prevent it.

Would not just printing the list like I did in the first example of using my_sub4() -- print @$x,"\n" -- without interpolation be better since it has the same output without the use of an additional function call?

This actually brings up another interesting realization about what perl is doing. When interpolating a list within double-quoted strings, the elements are seperated by the value of $" which default is a space. After some messing with code, it appears that when the list is used like this print @$x,"\n" the list is passed comma seperated to the print function. The output has no spaces like I was expecting. This can be seen when you modify the ouput field seperator $,= ' ' before the print and you will get the spaces back into the print. This doesnt effect your example, because the whole array is joined into a string instead of a list of ellements. Am I correct in understanding whats going on?

So it would appear that my way might be better for small lists, but I would think it might cause problem with bigger ones. Is there a limit to the number of comma seperated values you can pass to print?? Your oppinion on the the two?

Thanks for your help and suggestions.

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

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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2023-12-02 05:07 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (13 votes). Check out past polls.