in reply to Re^2: Format file2
in thread Format file2

split the line on whitespace and store the results in an array. If the number of stations is the 5th token on the line, access it like this:
my @tokens = split; my $num_st = $tokens[4];