http://qs321.pair.com?node_id=198032


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