On Mon, Jul 12, 2010 at 07:25, Rob Coops <rco...@gmail.com> wrote:
snip
> In other words you are using a function inside a function. If you split this
> into two lines.
> my @split_result = split /:/;
> print $outfile join(" ", "socks5", @split_result)
snip

By that logic it should read

my @split_result = split /:/;
my $join_result  = join " ", "socks5", @split_result;
print $outfile $join_result;

or more verbosely:

my @split_result = split /:/;
unshift @split_result, "socks5";
my $join_result  = join " ", @split_result;
print $outfile $join_result;

or the ridiculously magicless:

my @split_result = split /:/, $_, 0;
unshift @split_result, "socks5";
my $join_result  = join " ", @split_result;
print $outfile $join_result;

Using the output of one function as part of the arguments for another
is a common practice, and the sooner people learn how to deal with it
the better.

What I found confusing about the code was all of the useless
parentheses.  Why does join deserve parentheses, but print and split
don't?  What is the deal with the parentheses around join; are they
intended to add a visual distinction between print's filehandle and
its argument list?  Personally, I would write it like

print $outfile join " ", "socks5", split /:/;

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to