open (my $file, '<', 'formation.txt') || die "Error opening file: $!"; while (<$file>) { chomp; # removes trailing newline character print "Line contents: $_\n"; } #### my @lines; open (my $file, '<', 'formation.txt') || die "Error opening file: $!"; while (<$file>) { chomp; # removes trailing newline character push @lines, $_; }