--- "Tillema, Glenn" <[EMAIL PROTECTED]> wrote:
> Argh!
> 
> I'm trying to replace underscores with '%20' when I print out a table
> header. Right now I'm getting 1's instead of the substituted string! I know
> I'm forgetting something .. what am I forgetting?
> 
> BEGIN--Sample--code--
> 
> @serverColumns = qw{Server_Type Server_Name IP_Address Model Processor RAM
> Disk
>  Special OS Nic_Speed NIC_Duplex NIC_MAC Serial Function B_Time B_Config
> Contact
>  Location};
> 
> print start_table({-style=>'border-collapse: collapse',-border=>1});
> print Tr(map{th({-style=>'width:80'},s/_/%20/)} @serverColumns);
> 
> END--Sample--code--

First, I am guessing that you really want the %20 to be a space.  %20 is the value of 
a space in a
URL query string, so the following code assumes that you meant a space, but it should 
be easy
enough to adjust:

use strict;
use CGI qw/:standard/;

my @serverColumns = qw{ Server_Type Server_Name IP_Address 
                        Model Processor RAM Disk Special OS 
                        Nic_Speed NIC_Duplex NIC_MAC Serial Function
                        B_Time B_Config Contact Location };
@serverColumns = map { s/_/ /g, $_ } @serverColumns;

my $tableHeaders = '';
$tableHeaders  .= th( {-style=>'width:80'}, $_ ) foreach @serverColumns;

print table( {-style=>'border-collapse: collapse',-border=>1},
             Tr( $tableHeaders ),
             # build other table items here, if you wish
      );

As a side note, I like the way you got around not being able to use embedded spaces 
with assigning
to an array with qw//.

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to