Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
gives:#!/usr/bin/perl -w use strict; use CGI ':standard'; my $in = "url"; my $out; print "Content-type: text/html\n\n"; my @newin = split (/\s+/, $in); print "<br>@newin<br>"; my @out = split (/\s+/, $out); print "<br>@out<br>"; @out = push (@out, @newin); print "<br>@out<br>";
I had expected<br>url<br><br><br><br>1<br>
reproducing the contents of @newin.<br>url<br><br><br><br>url<br>
Could someone explain what is happening?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pushing arrays gives unexpected result
by Paladin (Vicar) on Feb 10, 2004 at 23:24 UTC | |
by Anonymous Monk on Feb 10, 2004 at 23:31 UTC | |
|
Re: pushing arrays gives unexpected result
by arden (Curate) on Feb 10, 2004 at 23:28 UTC | |
|
Re: pushing arrays gives unexpected result
by Roger (Parson) on Feb 10, 2004 at 23:27 UTC | |
|
Re: pushing arrays gives unexpected result
by duff (Parson) on Feb 10, 2004 at 23:25 UTC | |
|
Re: pushing arrays gives unexpected result
by davido (Cardinal) on Feb 11, 2004 at 05:18 UTC | |
|
Re: pushing arrays gives unexpected result
by BUU (Prior) on Feb 11, 2004 at 11:07 UTC |