CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: PERL interpreter misunderstand UNIX $ : Edit Log



NAS
New User

Oct 13, 2017, 3:56 AM


Views: 5205
PERL interpreter misunderstand UNIX $

Hi everybody,

I am a beginner in PERL scripting and I am facing an issue to finalise my first script. The aim is to launch the .pl from UNIX and to implement in the script a command shell that highlight few lines of a text to prompt.

SCRIPT-------------------------------------------------------------------------------------------
#! /usr/bin/perl
use strict;
use warnings;

my $x=qx(<piped shell commands> | egrep --color '.*<pattern>.*|$');
print "$x";
----------------------------------------------------------------------------------------------------

ERROR--------------------------------------------------------------------------------------------
Use of uninitialised value $' in concatenation (.) or string.
----------------------------------------------------------------------------------------------------


Even thought the command shell is in back-quotes the $ is not interpreted as command shell (until the end of the line) but as a PERL character (waiting for variable name). I have tried many solutions as use : system, regex, different typos ...
Nothing to do.

Then, is there a way to say to PERL that this $ belongs to the shell command ?

Thank you a lot for your help.


(This post was edited by NAS on Oct 13, 2017, 4:41 AM)


Edit Log:
Post edited by NAS (New User) on Oct 13, 2017, 4:02 AM
Post edited by NAS (New User) on Oct 13, 2017, 4:04 AM
Post edited by NAS (New User) on Oct 13, 2017, 4:39 AM
Post edited by NAS (New User) on Oct 13, 2017, 4:40 AM
Post edited by NAS (New User) on Oct 13, 2017, 4:41 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives