Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Insane Uses for Perl

by bart (Canon)
on Sep 15, 2002 at 13:23 UTC ( #198032=note: print w/replies, xml ) Need Help??


in reply to Insane Uses for Perl

Off-topic, I'm sure... but this line only gives me a compile error:
perl -le 's ssSss.s sSsSiss.s s$sSss.ss .$s\107ss.print'
Backslash found where operator expected at -e line 1, near "$s\" (Missing operator before \?) Bareword found where operator expected at -e line 1, near "107ss" (Missing operator before ss?) syntax error at -e line 1, near "$s\" Execution of -e aborted due to compilation errors.
What gives...?

Replies are listed 'Best First'.
Re: Re: Insane Uses for Perl
by jj808 (Hermit) on Sep 15, 2002 at 14:07 UTC
    I think that Sigmund is trying to use the s character as the delimeter in a substitution. Replacing this with / changes the code from
    perl -le 's ssSss.s sSsSiss.s s$sSss.ss .$s\107ss.print'
    to
    perl -le 's //S/s.s /S/Sis/.s /$/S/s.s/ .$/\107/s.print'
    This prints
    SisS
    Sigmund, is this correct?

    UPDATE:
    I have just read this node: Beware the S ! where Sigmund explains his signature, so it would appear that there was just a typo in the original post.

    The correct version,

    perl -le 's ssSss.s sSsSiss.s s$sSss.s s.$s\107ss.print'
    works fine and prints
    SiG
    Basically the 16th s should have been after the space, not before it.

    JJ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2020-10-26 19:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (252 votes). Check out past polls.

    Notices?