#! perl -w use strict; use Path::Tiny qw/ path /; my $file = '1135963.txt'; my @lines = path( $file )->lines( { chomp => 1 } ); foreach my $line ( @lines ) { if ( $line =~ m/^([^(]+)/ ) { print "$1\n"; } } __END__