in reply to Tree path analyzer regex problem (maybe other issues)?

It won't notice 'Valentine's' as a path that needs to be created,

That's not what I see. I see it creating path "Valentine's Day" twice and path "Valentine's" twice.

Valentine's Day Valentine's Day created new path! Valentine's Day|Cards Valentine's Day created new path! Valentine's Day|Flowers Valentine's created new path! Valentine's|Candy Valentine's created new path! Valentine's|Telegrams

For some reasons, you commented out use warnings; which tells you why you're creating the same path more than once.


By the way,

$prev_path !~ /^$parent$/

can fail since $parent contains plain text, not a regex pattern. You want

$prev_path !~ /^\Q$parent\E$/
or just
$prev_path ne $parent