#!/usr/bin/perl -w use strict; my $file = "test.txt"; # Text file to open my @newtext; # array to hold target data my $char = chr(186); # ACSII character º # Open the file open(FILE, "<$file") || die "Couldn't open $file: $!\n"; # If the contents of each line matches the º character at the beginning and end of the line, # push it onto an array. while() { if(/$char(.+)$char/) { push(@newtext, $1); } } close FILE; # Print out the results foreach(@newtext) {print "$_\n";}