Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Turning a hash into a line of links

by liverpole (Monsignor)
on Dec 12, 2006 at 20:21 UTC ( [id://589398]=note: print w/replies, xml ) Need Help??


in reply to Turning a hash into a line of links

Hi OfficeLinebacker,

How about something like this? ...

my @sorted = sort keys(%sections); for (my $i = 0; $i < @sorted; $i++) { ($i > 0) and print "|"; my $s = $sorted[$i]; print a({-href => "/$sections{$s}"}, "$s HOME"); }

It prints a leading | instead, but not before the very first link.

Update:  If you really want to do it with map, I'd suggest something like this:

print join("|", map { a({-href => "/$sections{$_}"}, "$_ HOME") } sort + keys %sections);

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Log In?
Username:
Password:

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

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

    No recent polls found