Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: passing a variable value to Unix command

by pobocks (Chaplain)
on Oct 19, 2010 at 23:38 UTC ( [id://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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-04-22 10:41 GMT
Find Nodes?
    Voting Booth?

    No recent polls found