Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: pack on unpack with same template

by hippo (Bishop)
on Jul 28, 2021 at 08:56 UTC ( [id://11135424]=note: print w/replies, xml ) Need Help??


in reply to Re^3: pack on unpack with same template
in thread pack on unpack with same template

Perl one-liners inside double-quotes generally aren't a problem on Linux unless there's a scalar variable in the code - and I deliberately crafted my one-liner without inclusion of a scalar variable in order to achieve that portability ;-)

You were also careful to ensure (or just lucky) that your code did not contain any of the default history control characters in a valid combination: !, ^ and #. These can vary from shell to shell and can (in many shells) be changed to other characters by the user. Try some of these rather contrived examples which will work if single quotes are used instead:

  • perl -E "say q/Hello!/"
  • perl -E "say q/Hello!!/"
  • perl -E "say q/found/ if shift =~ /^foo[^!#]/" foobar

IMHO there is no reason not to use single quotes to delimit the entire script on the command line in any non-MSWin32 system and it is almost always the better choice where shell interpolation is not expressly intended.


🦛

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-19 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found