[<<]Back to the programming manual

Programming Manual: Inline Perl Sample

A typical inline Perl application looks like this:
Any particular reason why you want
<code><perl>$address;</perl></code>?
Don't you have something better to do at
<perl>scalar localtime</perl> instead of waste
<perl>$hostname || (&sock_to_host())[0];</perl>'s time?
which comes out like

Any particular reason why you want /httpi/sperl.shtml? Don't you have something better to do at Sat Oct 25 02:30:15 2014 instead of waste ec2-54-90-128-222.compute-1.amazonaws.com/54.90.128.222's time?

In this example, we've done three things: retrieved a server-internal variable, returned an arbitrary Perl expression ("scalar localtime") and made a HTTPi-internal function call. All of these items returned something, which was displayed.


Cameron Kaiser