in reply to Re^8: Recursive search
in thread Recursive search

Please ignore the second query,changing the order of next as below fixed it,still having trouble with first one

next if $match_plf_name eq $plf; #print "IN\n"; push @recursive_plfs,$match_plf_name; next if ( not grep { /\Q$match_plf_name\E/i } @plf_fil +es); recursion($match_plf_name);

Replies are listed 'Best First'.
Re^10: Recursive search
by poj (Abbot) on Dec 17, 2010 at 22:42 UTC

      I actually dont want to use \w ,would it be possible for you to suggest soemthing generic ,meaning ,whatever is present betwen the last "/" and .plf should match including the .plf

      INPUT: //tools/scripts/script_rev1.1.plf //tools/scripts/fil&es_data.plf

      OUTPUT: script_rev1.1.plf fil&es_data.plf

        You nearly had it right before with .+, try this

        if ($line =~ /\/(.+\.plf$)/)
        poj

        As file names can contain anything but a slash, match anything but a slash - i.e. [^/]+ - between the last directory separator and .plf:

        if ($line =~ m|/([^/]+\.plf$)|) {