Brian wrote:
Hello again
Hello,
could someone please help me?
I will try.
$ZZZZZZZZZZ on line 38 is a single letter output from $string
(in this case "f")
I would like to get this value pushed to $ZZZZZZZZZZ on line 11
Then you have to assign a value to it *before* line 11.
as it stands, the error I get at the browser is that it can't find
c:/apache2/htdocs/testing/testing123/$ZZZZZZZZZZ.html
instead of finding (or not as the case may be)
c:/apache2/htdocs/testing/testing123/f.html
I assume that it is doing line 11 and failing before doing the calcs
further on.
I have tried moving lines about, but always get the same error.
#! c:\perl\bin\perl.exe
#! c:\perl\bin\perl.exe -T
use warnings;
use strict;
use CGI qw/:all/;
use CGI::Carp qw/fatalsToBrowser/;
use HTMLTMPL;
my $t = HTMLTMPL->new();
$t->src( 'c:/apache2/htdocs/testing/testing123/$ZZZZZZZZZZ.html' );
Strings in single quotes do not interpolate. You will have to use some
form of double quotes, for example:
$t->src( "c:/apache2/htdocs/testing/testing123/$ZZZZZZZZZZ.html" );
$t->src( qq[c:/apache2/htdocs/testing/testing123/$ZZZZZZZZZZ.html] );
my $parent = "c:/apache2/htdocs" . $ENV{ 'REQUEST_URI' };
$parent =~ m!c:/apache2/htdocs/testing/testing123!;
Why are you performing this match in void context.
$t->number_in( $number_in );
You are trying to use $number_in before you have assigned a value to it.
$number_in = 6;
$string1 = abcdef;
$string2 = ghijkl;
$string3 = mnopqr;
$string4 = stuvwx;
$number_out = $number_in;
while ($number_out > 24) {$number_out -= 24;}
Or, without the loop:
$number_out -= int( ( $number_out - 1 ) / 24 ) * 24;
if (($number_out > 0) && ($number_out <= 6)) {$string = $string1;}
if (($number_out > 6) && ($number_out <= 12)) {$number_out -= 6;$string
= $string2;}
if (($number_out > 12) && ($number_out <= 18)) {$number_out -=
12;$string = $string3;}
if (($number_out > 18) && ($number_out <= 24)) {$number_out -=
18;$string = $string4;}
That could be simplified to:
my @strings = qw( abcdef ghijkl mnopqr stuvwx );
my $string = $strings[ int( ( $number_out - 1 ) / 6 ) ];
$number_out = ( ( $number_out - 1 ) % 6 ) + 1;
$ZZZZZZZZZZ = substr $string, $number_out-1, 1;
You need to make this assignment before you need to use $ZZZZZZZZZZ.
$t->output( CGI::header );
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/