in reply to Problem with foreach loop

I can't duplicate your problem.

You're not changing @data, so (tied @data)->defer; and (tied @data)->flush; are useless. So is Tie::File, for that matter.

#!/usr/bin/perl use strict; use warnings; $ENV{HOME} = 'C:\Documents and Settings\kompeS\Desktop\PERL SCRIPTS'; my $file = "$ENV{HOME}/partno_C7_5.03.4_prod"; open(my $fh, '<', $file) or die("Unable to open input file \"$file\": $!\n"); while (<$fh>) { my ($map_dir,$dir,$part_no,$chg_lvl,$int_lock,$t_spec) = split /\s ++/; print " $map_dir,$dir,$part_no,$chg_lvl,$int_lock,$t_spec"; }