Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: simplifying substitution

by choroba (Cardinal)
on Mar 08, 2021 at 13:06 UTC ( [id://11129327]=note: print w/replies, xml ) Need Help??


in reply to Re^2: simplifying substitution
in thread simplifying substitution

Without the /x modifier, a space should match literally. What's the output of
perl -lwe 'print qq( $]) =~ s/ /v/r'
(use double quotes instead on MSWin)

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: simplifying substitution
by Polyglot (Chaplain) on Mar 08, 2021 at 14:18 UTC

    I get this output from that command (I'm not on Windows):

    Bareword found where operator expected at -e line 1, near "s/ /v/r" Unquoted string "r" may clash with future reserved word at -e line 1. Can't modify string in substitution (s///) at -e line 1, near "s/ /v/r " syntax error at -e line 1, near "s/ /v/r " Execution of -e aborted due to compilation errors.

    When I check the version, I get this:

    perl -v This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-th +read-multi-2level (with 2 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall

    Blessings,

    ~Polyglot~

      OK, 5.12 doesn't have /r. So what about
      perl -lwe '$v = qq( $]); $v =~ s/ /v/; print $v'
      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        perl -lwe '$v = qq( $]); $v =~ s/ /v/; print $v' v5.012004

        Blessings,

        ~Polyglot~

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found