Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Qiang's scratchpad

by Qiang (Friar)
on Jun 01, 2004 at 17:10 UTC ( #358262=scratchpad: print w/ replies, xml ) Need Help??

this is a copy & paste from hacker 's home node.
#!/usr/bin/perl
#
use strict;

my $x= <<EOF;
NAME='NBU 6.0 for Tru64 V5.1'
CODE=NBU
VERS=60
MI=NBU60.mi
ROOT=0
COMPRESS=1
RXMAKE=0
%%
YUNBU60 . 2 'NBU 6.0 (Tru64 V5.1)'

EOF

my $y = "echo '$x' > test";
run_me($y);

sub run_me { my $y=shift;`$y`}

running above gives me the error:
sh: -c: : syntax error near unexpected token `('
sh: -c: : `YUNBU60 . 2 'NBU 6.0 (Tru64 V5.1)''

## fixed with help from ambrus, thanks!
## he suggested puting the shell into another HERE doc then `` it. such as:

my $c = <<EOF;
echo "$k" > $pkg_k
EOF     
`$c`;


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2015-07-08 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls