in reply to Re: Using x to build data structures considered harmful
in thread Using x to build data structures considered harmful
I admit. I don't get it. :-)
foo(($x) x 2)is supposed to be a lazy way to do
foo($x, $x)right? How is that evil? They will both give the same results (i.e. that $x is 12 after the call). What might one expect instead? Is my translation incorrect?
The thing you get bitten by here is just the aliasing, not the x operator as I understand it.
Update: Ah, got it. My translation was incorrect (because it actually was a correct translation). Seems like Perl does good dwim in this case, with the i meaning ihb. :-) ($x) x $n in list context could be believed to be equivalent to
which both return copies of the values and the output would then bemap $x => 1 .. $n # or sub { ($x) x $n } -> ()
Good thinking, japhy.11 11 10
ihb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using x to build data structures considered harmful
by japhy (Canon) on Jul 18, 2004 at 03:23 UTC |