Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: passing a variable value to Unix command

by pobocks (Chaplain)
on Oct 19, 2010 at 23:38 UTC ( #866198=note: print w/replies, xml ) Need Help??


in reply to passing a variable value to Unix command

I'm not able to replicate your error; however, there are a few errors/potential errors in your code (at least as written).

In the array of keywords, the comma is wrong unless you mean it to be part of the pattern. "use warnings" catches this.

If you're using lexical variables, $x and @a need a "my" in front of them when declared. "use strict" catches this.

Here's the code with these corrections, and with strict and warnings turned on. It works on my system, but then again, so does the uncorrected code.

#!/usr/bin/perl use strict; use warnings; my @a = qw(xyz uvw tid bnjuw); foreach my $k ( @a) { my $name = $k."\*"; my $x = `find . -name "$name" -print`; }
for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2022-12-09 01:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?