use strict; use warnings; open IN, '<', 'notepad.exe.lnk' or die $@; my $pathchrs = ''; while () { my @strs = /([-\/\.[:alnum:]_\\:]{10,})/g; print join "\n", @strs; } close IN; #### notepad.exe C:\WINDOWS\notepad.exe