in reply to Turning a hash into a line of links
I know there are probably better ways, but I kind of had fun figuring this out in a way that's flexible if sections are added/subtracted.my $homes=join(" |",@la); #print $homes; my @pipes; my $pos; while ($homes =~ m/\|/g){ push @pipes, pos($homes)-1; } my $numps=scalar(@pipes); my $ptr= $numps-int($numps/2); #no ceil() function in perl substr($homes,$pipes[$ptr],1,"<br>");#not catching rv--is that bad? print $homes;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Turning a hash into a line of links
by johngg (Canon) on Dec 13, 2006 at 16:08 UTC | |
by OfficeLinebacker (Chaplain) on Dec 13, 2006 at 17:43 UTC | |
by johngg (Canon) on Dec 13, 2006 at 20:45 UTC | |
by OfficeLinebacker (Chaplain) on Dec 14, 2006 at 01:39 UTC |