Gossamer Forum
Home : General : Perl Programming :

In between code

Quote Reply
In between code
Does anyone know how can i write the following in perl?

I wan to write if hour is between 0 and 12 then doing something, like :

if ($Hour > 0 < 12 ) {
print "$morning";
}
elsif ($Hour > 12 < 18 ) {
print "$afternoon";
}
elsif ($Hour > 12 < 24 ) {
print "$evening";

but the server said i got some errors, can anyone point me to the right direction?


------------------
Bear EveryWhere
Quote Reply
Re: In between code In reply to
Bear,

Have a look at the last section of sub get_date in Alex's greeting script:

gossamer-threads.com/scripts/source/homepage.pl.txt

That should get you sorted out...

adam
Quote Reply
Re: In between code In reply to
Thanks. It really works!

Can anyone tell me how can I called the script? Using SSI?

Thanks.

------------------
Bear EveryWhere
Quote Reply
Re: In between code In reply to
Well, if you have SSI enabled, and your page is named accordingly, you can call the script with:

<!--#exec cgi="/path/to/script.cgi"-->

Make sure that the path is from document root and not server root. So if it's in your cgi-bin, it should look like this:

<!--#exec cgi="/cgi-bin/homepage.pl"-->

Cheers,
adam

[This message has been edited by dahamsta (edited June 14, 1999).]