Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Inserting, update and deleteting a database under conditions

by Nik
on Jan 09, 2008 at 12:49 UTC ( #661339=note: print w/ replies, xml ) Need Help??


in reply to Re: Inserting, update and deleteting a database under conditions
in thread Inserting, update and deleteting a database under conditions

The results of map are not 0 or 1, @menu_files actually stores the filenames from the strign with the path and txt
. How could i write the same thing with grep?


Comment on Re^2: Inserting, update and deleteting a database under conditions
Replies are listed 'Best First'.
Re^3: Inserting, update and deleteting a database under conditions
by Anonymous Monk on Jan 09, 2008 at 17:07 UTC
    my @menu_files = grep m{([^/]+)\.txt}, @files;
      If only was that easy

      I tried out but 'grep' doesn't strip the filename out of the bigger string, now pop up menu has entries like this:

      D:/www/data/text/name_of_the_file.txt

        I personally believe that then you should explain what it is that you want. Based on other nodes in this thread, I suppose that that's 'name_of_the_file.txt'. In that case, I would do:

        # untested use File::Basename; my @menu_files = map { my $n=basename $_; $n =~ /\.txt$/ ? $n : () } @files;
        --
        If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661339]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-07-30 21:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls