in reply to Text file manipulation

You need a function that compares two strings and returns "TRUE" if they are sufficiently similar and "FALSE" otherwise. In general, this is impossible. We must settle for a function that is good enough. We determine "good enough" by testing. Only you can determine how much testing is required. I doubt that your example of one match and several mismatches is sufficient. Here is a sample of test code using a match and a mismatch from your test cases. I have provided my first attempt (special_match) at you function to get you started.
use strict; use warnings; use Test::More tests=>2; my $should_match = 1; my $should_not_match = 0; my @cases = ( ['ON_DIE_FILLER/filler_fuse', 'die0_ON_DIE_FILLER_ON_DIE_FILLER_filler_fuse', $should_match, ], ['ON_DIE_FILLER/filler_fuse', 'die0_ON_DIE_FILLER_ON_DIE_FILLER_filler_byte', $should_not_match, ], ); foreach my $case (@cases) { if ($case->[2] == $should_match) { ok( special_match($case->[0], $case->[1]), $case->[1]); } else { ok( !special_match($case->[0], $case->[1]), $case->[1]); } } sub special_match { my ($s1,$s2) = @_; $s1 =~ tr{/}{_}; # fix separator return $s2 =~ m/$s1$/; # $s1 at end of $s2 } OUTPUT: 1..2 ok 1 - die0_ON_DIE_FILLER_ON_DIE_FILLER_filler_fuse ok 2 - die0_ON_DIE_FILLER_ON_DIE_FILLER_filler_byte
Bill