Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Another 'ode to backslash' ;-)

by EvanK (Chaplain)
on Sep 24, 2001 at 10:22 UTC ( [id://114255]=note: print w/replies, xml ) Need Help??


in reply to Another 'ode to backslash' ;-)

That's really pretty cool...but a suggestion to make it a little less annoying and a LOT shorter:
@a=('\' x 74,'\' x 117,'\' x 115,'\' x 116,'\' x 32,'\' x 65,'\' x 110 +,'\' x 111,'\' x 116,'\' x 104,'\' x 101,'\' x 114,'\' x 32,'\' x 80, +'\' x 101,'\' x 114,'\' x 108,'\' x 32,'\' x 72,'\' x 97,'\' x 99,'\' + x 107,'\' x 101,'\' x 114);foreach $a(@a) {print length $a, ",";}

______________________________________________
RIP
Douglas Noel Adams
1952 - 2001

Replies are listed 'Best First'.
Re: Re: Another 'ode to backslash' ;-)
by hopes (Friar) on Oct 02, 2001 at 23:00 UTC
    There is an error in your code. See perldoc perlop
    or see perlop

    q/STRING/
    'STRING'
    A single-quoted, literal string. A backslash represents a
    backslash unless followed by the delimiter or another backslash,
    in which case the delimiter or backslash is interpolated.


    So '\' don't is what you expect. You have to write '\\' instead.
    Yeah, it's tricky. Note that
    print '\\\machine';
    is the same as
    print '\\\\machine';
    but not
    print '\\machine';
    You can use q;\\; if you want to obfuscate more.

    Regards

    Hopes
Re: Re: Another 'ode to backslash' ;-)
by Asmo (Monk) on Sep 24, 2001 at 18:45 UTC
    yes, of course it's shorter, but it's not the same result on the screen whenn you look at the code ;-) anyway, thx for your reply

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://114255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found