Thanks for all the quick responses. I'll be sure to vote up a bunch of posts. I ventured over to the other thread and found this code. I don't really understand what is occurring, so I thought I could explain it to the best of my abilities, and you guys could help by filling in the gaps?
#! perl -slw
use strict;
my @a = 1..3;
my @b = 'a'..'f';
my @c = map chr, 33 .. 37;
nFor( 3, \@a, \@b, \@c ); #3 sets the number of arrays to sift through
+.
sub nFor {
my $n = shift; #I understand shift chops off the first element in
+an array, but what purpose does that serve? Also, how are the arrays
+ (@a, @b, @c) referenced in this code?
if( $n ) { #what exactly is $n?
for my $i ( @{ shift() } ) { # I have no idea how $i get's it'
+s value?
nFor( $n-1, @_, $i ); #why does the top nFor call for 4 va
+riables, while this one only calls for 3?
}
}
else {
print join ' ', @_;
}
}
I love it when a program comes together - jdhannibal
-
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.