in reply to incrementing a column

Anonymous Monk,
Since you were not overly verbose on your requirements, this is the best I can offer:
#!/usr/bin/perl use strict; use warnings; my $prev_col; my $counter; while ( <DATA> ) { chomp; my ($col, $rest) = $_ =~ /^([^\s]+)(\s.*)$/; if ( ! defined $prev_col || $col ne $prev_col ) { $counter++; $prev_col = $col; } print "$col $counter$rest\n"; } __DATA__ aa one two three aa four five six xy z xy a xy b cc asdfasdf

Cheers - L~R