Perl syntax question

Hallo everybody,

I have a following problem - I'm doing a map funciont to fill in a HTML table and I want to use some radiobutton groups. Unfortunatelly, they are grouped by names, so I have to add some "counter" that will divide one row from another, and I'm using CGI.pm for generating the table.

print $qry->table ({ Border => 1, Cellpadding => 3, bordercolor =>"#FFFFFF"},
   Tr(map{th($_) } @Head),
   (map {
    my ($Uid, $Fna, $Extnr, $Org, $Addr) = split /\|/, $_;
    my $ZaZ =0;
      Tr(
      td(textfield('UID', "$Uid",6)),
      td(textfield('FNA', "$Fnamn",20)),
      td(textfield('BEF', "$Extnr",16)),
      td(textfield('NYTT', "$Ankn",5)),
      hidden('ADRE', $Addr),
      td(checkbox_group('GRU',['P', 'F', 'K', 'Ej'],'Ej')),
      td(radio_group("DOL[{[$ZaZ+1]}]",['Ja', 'Nej'],'Nej')),
      td(radio_group('CMG',['Ja','Nej'],'Nej')),
      ); 
    }
  <TEMP>), #/map
  ); 

Now in BASH I could easily write for example

td(radio_group("DOL[�expr $ZaZ +1`]", ['Ja', 'Nej'],'Nej')) 

to get $ZaZ incrised by one all the time, but how do I do that in perl ?

Thanks in advance.

You may be better off posting this sort of question in perlmonks.org?

@bar = map {} @foo; 

is a loop as you know. You can have a counter like this

my $cnt = 0;
@bar = map { $cnt++; $_ . $cnt } @foo;

large maps are unwieldy, perhaps build up your data into an array first then feed it to the print when its ready?

Hej djzort and thanks for your post. I chose map only cause I didn't know how to refer to every line in the file I'm reading from and have it in the same print $qry-> table command (just switched from bash to perl). I've tried with for and foreach but with no success...

You can use 'while'

 while (my $line = ) {     # do something with $line } 

I want to post a link to the perldoc website with all the details, but this forum wont let me. if you have perldoc installed, run 'perldoc perlsyn' for the perl syntax documentation. Its also in pretty html on the perldoc website.