in reply to Is $# still used?

It's documented as deprecated, so it probably is. I've never used it, but a few trials turn up some fishy results:

$ perl -e'$_=1.657329486;$#="%8d";print,print $/' -330231720 $ perl -e'$_=1.657329486;$#="%05f";print,print $/' 1.657329 $ perl -e'$_=1.657329486;$#="%06f";print,print $/' 1.657329 $ perl -e'$_=1.657329486;$#="%08f";print,print $/' 1.657329 $ perl -e'$_=1.657329486;$#="%s";print,print $/' Segmentation fault (core dumped) $
Yet another solution to the age-old question of how to make perl segfault.

I haven't seen HOP yet. Is MJD talking about the $#foo construct for the last index of @foo, instead?

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Is $# still used?
by jonadab (Parson) on Jun 11, 2005 at 12:40 UTC

    $# has been deprecated at least since the second-edition Camel, and I guess probably since the early 5.0 days, which is virtually forever. However, it is still occasionally used and/or abused, especially in obfuscated code. It does not exist in Perl6, so its usage will die out with Perl5 usage, which, judging by the claims you occasionally hear that Perl4 is still in use some places, could be some time after Duke Nukem Forever is released.


    "In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68
Re^2: Is $# still used?
by ambrus (Abbot) on Jun 11, 2005 at 15:23 UTC