in reply to Re: !~ /\w/ challenge, anyone?
in thread !~ /\w/ challenge, anyone?

Can you do it without the "_" character? I think finding ways to stick something in there implicitly will be one of the essential skills of this kind of challange.

Is it necessary to redirect file to the script instead of letting <> read the argument?

I see that the ++ compensates for the fact that one line was already read via -p. Cute.

—John

Replies are listed 'Best First'.
Re: Re: Re: !~ /\w/ challenge, anyone?
by broquaint (Abbot) on Feb 05, 2003 at 17:26 UTC
    Is it necessary to redirect file to the script instead of letting <> read the argument?
    Yep, otherwise it'll just hang waiting on STDIN.

    Here's a solution that adheres to the rules but is awful sneaky

    shell> cat > obfuwc.pl #!/usr/bin/perl -lp -s ++(${$::{$-}}=()=<>) ^D shell> chmod +x obfuwc.pl shell> ./obfuwc.pl --=_ < file
    So the actual code passes the /\w/ but sneaks through the rules by passing in _. I can't say I'm proud ;)
    HTH

    _________
    broquaint

      Why would it wait on STDIN, instead of opening and reading from file?