0

I've a perl script which displays a table with hyperlinks on a browser. When i use,

< a href="http://www.xyz.com">7231-R</a>

I'm able to get the hyperlink-ed "7231-R" text displayed on the browser and thereby when i click on 7213-R it takes me to the desired page. But for the other link in the table on webpage, i'm using if else condition in the perl script and assigning hyperlink to a variable as below:

if($astatus eq "PASS" && $kstatus eq "PASS"){
          $value = "< a href=\"http://www.xyz.com\">7231-R</a>";}
elsif($astatus eq "FAIL" || $kstatus eq "FAIL"){
          $value = "NA";}

Now, i'm displaying $value in the other column of the table. Here, i should also be getting a 7231-R with hyperlink if the if condition is true, but i'm only getting the text 7231-R without the hyperlink. What could be the problem? Kindly help.

Thanks in advance, Sharath

Sharath
  • 61
  • 2
  • 9

1 Answers1

1

You're using double quotes within double quotes. You either need to escape them:

$value = "< a href=\"http://www.xyz.com\">7231-R</a>";

Alternate quote type:

$value = '< a href="http://www.xyz.com">7231-R</a>';

or use a quote like operator:

$value = q{< a href="http://www.xyz.com">7231-R</a>};
RobEarl
  • 7,862
  • 6
  • 35
  • 50
  • Thanks for the reply. Sorry RobEarl, infact i had escaped them, just forgot while typing it here. Will try with the alternatives you have given now. – Sharath Sep 07 '13 at 09:45
  • Rob, I just tried the solutions but its still not showing the hyperlinks, only text is showing up! I tried to display the value of $value before entering into table and its empty. – Sharath Sep 07 '13 at 10:00
  • With the first alternate solution, i'm getting the whole code showing in the table like this. < a href="http://www.xyz.com"&gt7231-R – Sharath Sep 07 '13 at 10:09
  • @Sharath It is not clear what your problem is. First you say only the text is showing up, then you say that `$value` is empty. It can't be both, so which is it? Also, when you say "showing up", do you mean what you can see in the browser, or what you can see in the HTML source? – TLP Sep 07 '13 at 10:17
  • sorry for the confusion created. What i meant by "text is showing up" is that the webpage shows only 7231-R text with no hyperlink. And "$value is empty" meant i'm a doing a "print "$value\n";" in the perl script just before entering the table and its value is showing as empty on the console/command-prompt just after running the perl script. Hope i've cleared. – Sharath Sep 07 '13 at 10:29
  • @Sharath Show the minimal example in your question, so that people could reproduce your problem. – user4035 Sep 07 '13 at 10:39
  • @Sharath if you could provide the code for the table, it would be helpful – cur4so Sep 07 '13 at 18:36