Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

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

Thanks very much for your responses, guys. I've learned a lot, but I don't think I'm quite there yet. I took Kenosis's code and turned it into this:

use strict; use warnings; my @array = ([0,.95,.114,0], [1,0,0,1], [1,3,5,7]); my $var; my @a; for (my $i = 0; $i <= $#array; $i++) { $a[$i] = join ',', @{$array[$i]}; $var .= "\{\$a\[$i\]\}-"; # can't use singl +e quotes here because $i won't resolve } #my $a = join ',', @{$array[0]}; #print "$_\n" for glob "{$a[0]}-{$a[1]}-{$a[2]}"; #this line works, + but it's not dynamic, ie. always prints out exactly three lines print "$_\n" for glob $var; #this line doesn' +t work; apparently you can't resolve a variable to glob (?) print "$var\n\n"; #this line shows +what the $var variable is passing to glob in line 17

The 'for' loop works fine for the first step, but I get tripped up on the second step. I thought I might be able to push the new reference onto a variable each time through the loop and then pass that variable to glob, but I tried it with and without quotes, and it doesn't seem to work.

As for kcott's idea, try as I might, I cannot parse the following line of code:

say for glob '{' . join('}-{' => map { join ',' => split } <DATA>) . ' +}';

I understand what join does, and I also understand map and split. But the way they are combined here is a little bit beyond my ability to comprehend. For example, where is the second argument for the first join?

In any case, the problem that remains seems to be getting each row of the array together into one glob statement. If I could do that, the modified Kenosis code above would work, I think.

Thanks again to everybody for the time you have taken to help me try to get this resolved.


In reply to Re^4: sending a scalar to the interpreter as a command by silentq
in thread sending a scalar to the interpreter as a command by silentq

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (10)
    As of 2014-08-22 10:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (153 votes), past polls