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~