Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Perl, too. (Probably not a coincidence.)

You can also put a newline in a variable name if you really want. Or a 0 byte.

Here's a demo. I've used the debugger because its "X" command can print the true name of the variable:

    $ perl -d -e 1

    Loading DB routines from perl5db.pl version 1.60
    Editor support available.

    Enter h or 'h h' for help, or 'man perldebug' for more help.

    main::(-e:1):       1
      DB<1> ${"variable-name"} = 123;

      DB<2> ${"variable\nname"} = 456;

      DB<3> ${"variable\0name"} = 789;

      DB<4> X ~variable
    $variable^@name = 789
    $variable^Jname = 456
    $variable-name = 123


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: