Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Easy (?) perl syntax question



Darren Cook wrote:
 
> >>   if($data{'formnum'} eq "1")$formnum="1";

> >Hmm let's see this should do it....
> >...
> >or
> >   if ($data{'formnum'} eq "1"){ $formnum = "1" }
 
> Okay, I see - I need {}. I'm thinking like a C programmer :-).

i c

> >Where do you get the value for $extension? Are you overwriting the
> >$extension somewhere in the script?
 
> $extension is fine - I'm fairly sure it's $formnum that is the problem.
> When I did this:
>  $formnum="";
>  if($data{'formnum'} eq "1"){$formnum="_1"}
> ...
>  print "<!--$data{'formnum'}-->\n";

put a space between variable and minus because if you don't perl thinks
you want to do something like $i--; 
I know you put the number between quotation marks but even if you do
that perl will convert to an int, try this example:
$i = "2"; # initializing 2 as a string
$i--;     # being converted to a number & subtracting 1
print $i  # prints 1

perl will convert your string to an int!

>  print "<!--$formnum-->\n";
>  print "<!--$wfile-->\n";

> Then in the HTML I see:
> <!--1>
> <!---->
> <!--19981025.csv-->

> The 1 has somehow removed the "--" characters. Also the if does not seem to
> have worked.

see above...

> Now I change my to:
>   $formnum=$data{'formnum'};

> And in the HTML I see:
>  <!--1>
>  <!--1>
>  <!--199810251>
>              ^^^ It's put the 1 there, but removed everything that
> followed: ".csv--"

put the spaces between the HTML comments and the variable in and run the
script again... 

urs

-- 
u r s  r o e s c h             h a c h i o j i,  t o k y o
----------------------------------------------------------
e# urs@example.com                   aim# uru uru 71
w# http://www.digital-mines.com              icq# 13780972
---------------------------------------------------------------
Next Nomikai: 20 November, 19:30 Tengu TokyoEkiMae 03-3275-3691
Next Technical Meeting: January, 1999 (details TBA)
---------------------------------------------------------------
Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links