http://qs1969.pair.com?node_id=866198


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";