my $string = '( | No Qualifier | | '; my $start = index( $string, '|' ); # find first pipe position my $end = index( $string, '|', $start+1 ); # find next pipe position my $qualifier = substr( $string, $start, $end-$start+1 ); # extract #### use IO::File; use Text::CSV_XS; my $csv = Text::CSV_XS->new({ sep_char=>'|' }); my $io = IO::File->new('myfile.piped.txt', '<') or die "Can't read file: $!\n"; until ($io->eof) { my $row = $csv->getline($io); # read and parse line into an ARRAYref print "Second field says: ", $row->[1], "\n"; }