in reply to On References to the Unnamed

Quoting is not an identity function in Perl. Don't treat it like one or you'll eventually get bitten.

Make a proper identity function instead (simplified to only return the first arg instead of all of them):

sub ident { shift } bless \(ident($_)) => 'Foo' for 3;

A little more typing? Yes. Avoids subtle bugs? Yes :)

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Replies are listed 'Best First'.
Re^2: On References to the Unnamed
by Anonymous Monk on Mar 16, 2005 at 09:22 UTC
    Quoting is not an identity function in Perl.
    That's the point of \"$_", isn't?

      Right. People expect "$_" to return the same data (i.e., an identity function). But that's not strictly true in Perl, due to the way Perl does implicit conversions.

      "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.