Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: SCALAR ref error help!

by delirium (Chaplain)
on Aug 03, 2011 at 15:38 UTC ( [id://918310]=note: print w/replies, xml ) Need Help??


in reply to SCALAR ref error help!

There are a few bad things going on. First, change the name of the sub to something else; "menu" is used by one of the other modules, and there is a name collision.

Second, $address doesn't get initialized anywhere. Third, don't print from the sub, return the value.

Last, the uri_escape interpolation seems to be wrong somehow, but I didn't try to rewrite it as is, because it's hard to read, and you're doing it three times needlessly. Instead, call it outside of the qq statement. Try something like this:

Main script:
#!/usr/bin/perl -w use strict; use CGI qw(:standard); use URI::Escape; require "call_b.pl"; my $go_menu = &menu2; print "Content-type: text/html\n\n"; print $go_menu;
call_b.pl
#!/usr/bin/perl -w use strict; use CGI qw(:standard); use URI::Escape; my $address = uri_escape("some address"); sub menu2 { return qq| <td> <ul> <li><a href="home.pl?contatc=$address&amp;selected_tab=a" targ +et="_top">home<b></b></a></li> <li>etc..</li> </ul> </td> |; } 1;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://918310]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-16 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found