Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

broquaint (2964)

broquaint
  (email not shown publicly)

Journal of broquaint (2964)

Tuesday November 26, 2002
12:03 PM

Not your usual perl

[ #9154 ]
I kid you not

$foo = "a string";
print "${";
foo} or is it?

__output__

a string or is it?

broquaint out

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Nice one!

    That's even simpler than the examples I found - you've demonstrated the problem without the hash lookup.

    (Patches welcome [mailto])

    • The code was adapted from japhy [perlmonks.org]'s New Obfuscation Trick! [perlmonks.org]. You'll get it whenever you use brace to quote/dereference something in an interpolated string e.g

      $foo = "a string";

      print "[${";
      foo}]

      $bar = qq<[${>;
      foo}]

      print $bar;

      @baz = qw( a list of strings );

      print qq([@{);
      baz}]

      $str = "dereferenced";
      $strstr = 'str';

      print "[${";
      $strstr}]

      %hash = qw( ichi ni );
      print "[$hash{"
      ichi}]

      __output__

      [a string]
      [a string]
      [a list of strings]
      [dereferenced]
      [ni]

      Would love to knock up a patch but wouldn't have the f

      --

      broquaint out