Gossamer Forum
Home : General : Perl Programming :

Simple, but returns 1?

Quote Reply
Simple, but returns 1?
Can anyone see why this would return 1?

Code:
sub test {

# we can test if the template is working ok here..



$show = "This is where the content would go...";

open(TEMPLATE, "shoptemplate.htm") || &error("Unable to open template file! Reason: $!");

while (<TEMPLATE>) {



$_ = s/CONTENT/$show/g;

print $_;



} # end the while

I know for a fact that shoptemplate.htm DOES contain some HTML, but it just doesn't want to show it Unsure

Cheers for any ideas....I just can't see why its not working :-|

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Simple, but returns 1? In reply to
Try
Code:
while (<TEMPLATE>) {
s/CONTENT/$show/g;
print;
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Simple, but returns 1? In reply to
Thanks....it works great. Any reason why $_ was holding 1 though, and simply not defining the variable made it work?

Cheers Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Simple, but returns 1? In reply to
You used '=' instead of '=~'

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Simple, but returns 1? In reply to
OMG...you are right....how on earth did I miss that! Crazy

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Simple, but returns 1? In reply to
Sigh, I see you still aren't using strict coding.
Quote Reply
Re: [Paul] Simple, but returns 1? In reply to
"Everyime you don't use strict .. god kills a kitten!"

- wil