problems with double quotes in PERL


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problems with double quotes in PERL
# 8  
Old 09-15-2008
Quote:
Originally Posted by frank_rizzo
can you post the errors?
Sure can... from /var/log/apache2/error.log

Code:
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] Warning: XML::LibXML compiled against libxml2 20632, but runtime libxml2 is older 20630, referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] ERROR : Garbage 'dashes, referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] ' after command:, referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] HRULE:29.92#BBBB00:"29.92 constant":dashes, referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] , referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] Premature end of script headers: weather.cgi, referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210
[Mon Sep 15 15:19:02 2008] [error] [client 192.168.1.5] Warning: XML::LibXML compiled against libxml2 20632, but runtime libxml2 is older 20630, referer: http://192.168.0.2/cgi-bin/weather.cgi?zip=90210

# 9  
Old 09-15-2008
does
Code:
perl -c weather.cgi

run clean?

can you post the line(s) with the call to rrd?
# 10  
Old 09-15-2008
Odd... it works for me:

Code:
#!/usr/bin/perl -w
my $var = "30.0";
print "HRULE:$var#BBBB00:\"$var constant\":dashes\n";

Code:
-bash-3.00$ ./test_quotes.pl
HRULE:30.0#BBBB00:"30.0 constant":dashes

# 11  
Old 09-15-2008
try this -- add 2 backslashes before the colon


Code:
"HRULE:$var#BBBB00:\"$var constant\"\\:dashes\n";

# 12  
Old 09-15-2008
Quote:
Originally Posted by frank_rizzo
does
Code:
perl -c weather.cgi

run clean?

can you post the line(s) with the call to rrd?
Code:
perl -c weather.cgi
weather.cgi syntax OK

Sure does.... this is crazy that rrdtool will not accept the dahses option through my perl script but it will if I do it through the shell!
# 13  
Old 09-15-2008
did you try to add the 2 backslashes in post #11?
# 14  
Old 09-15-2008
Quote:
Originally Posted by frank_rizzo
try this -- add 2 backslashes before the colon


Code:
"HRULE:$var#BBBB00:\"$var constant\"\\:dashes\n";


It accepted it this time, but the output isn't correct. It should draw a dashed line on a graph @ the value of the constant. When I add the two dashes, it treats the :dashes as part of the description which reads,
Code:
"30 constant":dashes

:/
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

2. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies

3. Shell Programming and Scripting

Preserve commas inside double quotes (perl)

Hi, I have an input file like this $ cat infile hi,i,"am , sam", y hello ,good, morning abcd, " ef, gh " ,ij no, "good,morning", yes, "good , afternoon" from this file I have to split the fields on basis of comma"," however, I the data present inside double qoutes should be treated as... (3 Replies)
Discussion started by: sam05121988
3 Replies

4. UNIX for Dummies Questions & Answers

grep single quotes or double quotes

Unix superusers, I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
Discussion started by: george_vandelet
2 Replies

5. Shell Programming and Scripting

How to substitute the value with in double quotes in perl?

Hi, I have string like this: $str=' DNA OR ("rna AND binding AND protein")'; I just wanted to substitute AND with a blank. How can i do that? I want the output like this: $string= DNA OR ("rna binding protein") (3 Replies)
Discussion started by: vanitham
3 Replies

6. Shell Programming and Scripting

Perl echo with double quotes

I need to echo a string that has double quotes in a Perl script. #!/usr/bin/env perl `echo Rule123 -comment \"blah blah\" >> $filename` I'd like to get below appended to $filename: Rule 123 -comment "blah blah" But instead, the double quotes are lost: Rule 123 -comment blah bah ... (1 Reply)
Discussion started by: slchin
1 Replies

7. Shell Programming and Scripting

Single quotes and double quotes

Hi guys, I have a sed line in double quotes which works fine, but I want it to be in single quotes here is the sed line sed "/abc_def/s/\'.*\'/\'\${abc_def}\'/" can some one give the equivalent to the above script in single quotes Thanks a ton (5 Replies)
Discussion started by: sol_nov
5 Replies

8. Shell Programming and Scripting

Double quotes or single quotes when using ssh?

I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example, $ ITSME=itsme $ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME" itsme $ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME' itsyou $... (3 Replies)
Discussion started by: password636
3 Replies

9. Shell Programming and Scripting

Displaying double quotes using Perl

Hi Guys, I'm a Perl newbie and was wondering if there's a way of displaying double quotes within double quotes. I'm try to print the contents of the variable to a file by using the system function. Here is an example of my code: #============================== $website = <STDIN>;... (2 Replies)
Discussion started by: kbdesouza
2 Replies

10. Shell Programming and Scripting

PERL, extract value between double quotes

I know this is probably much simplier than I am making but I need some help please. I have a data file that contains a value on the first line between double quotes ("00043"). I need to assign the value between the first set quotes to a variable in my perl script for comparison analysis. Also,... (6 Replies)
Discussion started by: methos
6 Replies
Login or Register to Ask a Question