Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Any tips on passing bash variables as arguments to a perl script (that contain spaces and/or non-ascii characters)

by RonW (Parson)
on Apr 17, 2015 at 22:35 UTC ( [id://1123836]=note: print w/replies, xml ) Need Help??


in reply to Any tips on passing bash variables as arguments to a perl script (that contain spaces and/or non-ascii characters)

Besides wrog's suggestion to enclose them in double quotes, you can export them, then they will be accessible in Perl via %ENV

#!/usr/bin/bash # do other processing # export the desired variables export OPC_MSG_TEXT OPC_MSG_CODE # use Perl for further processing ovo-test.pl
#!/usr/bin/perl use strict; use warnings; my $text = $ENV{OPC_MSG_TEXT}; my $code = $ENV{OPC_MSG_CODE}; ...;
  • Comment on Re: Any tips on passing bash variables as arguments to a perl script (that contain spaces and/or non-ascii characters)
  • Select or Download Code

Log In?
Username:
Password:

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

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

    No recent polls found