$line =~ /(0x\d{7}) # octal \s+ # space of some kind (.*) # anything (greedy) \s+ # space of some kind (0x\d{7}) # octal \s+ # space of some kind (\d+\.?\d?\.) # float, followed by a period \s+ # space of some kind (\d+\.?\d?) # float /x; # allow these comments @array[0..4] = ($1,$2,$3,$4,$5);