#!/usr/bin/perl use strict; use warnings; my @isbns = ('0-596-10092-2','3-97003-615-X'); @isbns = map{$_ =~ s/-//g;$_}@isbns; my $check = '0092'; my @treffer = grep{index($_,$check) == 5}@isbns; print $_,"\n" for @treffer;