Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How do you run a subroutine from inside HTML code?

by Anonymous Monk
on Mar 15, 2006 at 20:54 UTC ( [id://536936]=note: print w/replies, xml ) Need Help??


in reply to Re: How do you run a subroutine from inside HTML code?
in thread How do you run a subroutine from inside HTML code?

I'd first think to try the following, but that may be perl6 interpolation talking:

my $index = \&login; for (keys %{$_[0]}) { print qq[<TD WIDTH="$table_vars{$_}">\n$index->()\n</TD>\n]; }

Generally, and definitely perl5, "@{[foo()]}" calls &foo as list context and interpolates the return value as with an array and "${\foo()]}" similarly, with scalar context and as a scalar.

For your particular example, however, I'd just use printf.

for (keys %{$_[0]}) { printf qq[<TD WIDTH="$table_vars{$_}"\n%s</TD>\n], $index->(); }

There is no need to escape quoting delimeters in Perl.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found