This question was first posted at this site.
Other than the change from "6 identical lines" to "3 identical lines" and the removal of newlines, the OP is a verbatim, blatant plagiarism of this original post:
[Please enter your report here]
The perl program below should print 6 identical lines,
but one of them is different, which appears to be a very
serious bug, perhaps in the optimization of "map".
It appears to not be Solaris-specific.
I also see this on Linux perl 5.6.1.
$ perl <<'EOF'
sub f1 {
my ($f) = @_;
my @z = ("$f");
for my $d (@z) {return $d}
}
sub f2 {
my ($f) = @_;
for my $d ("$f") {return $d}
}
sub f3 {
for my $d (@_) {return $d}
}
print map {f1($_)} qw(x y z); print "\n";
print map {f2($_)} qw(x y z); print "\n";
print map {f3($_)} qw(x y z); print "\n";
for my $a (qw(x y z)) { print f1($a) } print "\n";
for my $a (qw(x y z)) { print f2($a) } print "\n";
for my $a (qw(x y z)) { print f3($a) } print "\n";
EOF
xyz
zzz
xyz
xyz
xyz
xyz
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
-
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.
|