Reputation: 29066
I would like to make a small script that color the output in green. I wrote this:
#! /usr/bin/perl -w
use Term::ANSIColor;
my $prg = join(" ",@ARGV);
print(color('green'). `$prg` . color('reset'));
Unfortunateyl it is not working because join('',@argv);
doesn't act as expected. For instance if I pass the arguments : "foo" "bar"
, I will get foo bar
without quotes.
How to just get all the command line arguments without removing escape quotes ?
Upvotes: 0
Views: 405
Reputation: 50637
You're fighting with shell, not perl; try
perl script.pl '"foo"' '"bar"'
Upvotes: 7