#!/usr/bin/perl -w use strict; my @pos; while (<>) { m/\s+/g; push @pos, pos(); } print @pos;