#global vars
@data = ( "init", "init", "init", "init" );
for ( my $row=0; $row<2; $row++ ) {
for( my $col=0; $col<$#headers+1; $col++) {
my $e;
if( $row == 0 ) {
$e = $tableWidget->Button (
-relief => "groove",
-justify => "left",
-text => $headers[$col],
-state => 'active',
-width => length($headers[$col])
);
} else {
$e = $tableWidget->Entry (
-width => $lens[$col],
-textvariable => \$data[$col]
);
}
$tableWidget->put( $row, $col, $e );
}
}
####
sub update {
...
@data = ( / ... big long regex ... /g);
...
}
####
...
# global variables
my $col_0;
my $col_1;
my $col_2;
my $col_3;
...
for ( my $row=0; $row<2; $row++ ) {
for( my $col=0;$col<$#headers+1;$col++) {
my $e;
if( $row == 0 ) {
$e = $tableWidget->Button (
-relief => "groove",
-justify => "left",
-text => $headers[$col],
-state => 'active',
-width => length($headers[$col])
);
} else {
if ( $col == 0 ) {
$e = $tableWidget->Entry (
-width => $lens[$col],
-textvariable => \$col_0);
} elsif ( $col == 1 ) {
$e = $tableWidget->Entry (
-width => $lens[$col],
-textvariable => \$col_1);
} elsif ( $col == 2 ) {
$e = $tableWidget->Entry (
-width => $lens[$col],
-textvariable => \$col_2);
} elsif ( $col == 3 ) {
$e = $tableWidget->Entry (
-width => $lens[$col],
-textvariable => \$col_3);
}
$tableWidget->put( $row, $col, $e );
}
}
}
...
sub update {
...
@data = ( / ... big long regex ... /g);
...
$col_0 = data[0];
$col_1 = data[1];
$col_2 = data[2];
$col_3 = data[3];
}