Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a string

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am trying to pass a random number into an Flash Actionscript using the following simple script.
Code:
#!perl

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);

use strict;
use warnings;
use CGI;

print "Content-type: text/html\n\n";

my $r=int(rand(3))+1;

print "&picture=[red]$r[/red]&";
$r is being passed as literally '$r' rather than the random value.
If I just call the script in a browser, the correct value is printed.
If I substitute $r for a text string, the text string is passed.
Can anyone suggest a solution?
Up until this, my Monday was going so well.

Keith
 
I think the problem is the string is just not being interpolated but why that is not happening is a mystery.

I haven't seen any mention of specific formatting but non of the examples I have seen actually creates the string from variables, they are just simple strings read from a text file.

I want to bolt this onto an existing app so the ability to pass vars is essential.

Keith
 
Something to do with the characters around it having special meanings perhaps? Try ${r}?

Annihilannic.
 
As usual there was a simple solution to it.
The perl script was doing its job but the Flash file was reading from the cache rather than the new value. Putting a random value into the script call, forced a new value.

Thanks for your assistance.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top