Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Looking up elements of an array in another array!

by Anonymous Monk
on Mar 16, 2013 at 07:29 UTC ( #1023822=note: print w/ replies, xml ) Need Help??

Comment on Re^3: Looking up elements of an array in another array!
Re^4: Looking up elements of an array in another array!
by better (Acolyte) on Mar 16, 2013 at 17:37 UTC

    Hi Anonymous Monk,

    after playing around a little with different scripts, and learning about the use of modules in perl, I added a line into your script to achieve my aim of creating a file importer.

    The job is almost done.

    It works fine, if I create the text file 'indexDS.txt' via perl. The problem I couldn't solve, is that, as soon as I change the text file by opening with notepad (windows), it crashes. I tried to implement ':encoding(utf8)'. Without success.

    At least I managed to parse the original excel file (with all the IDs in the first coloumn) and convert it into a text file using encoding(utf8). But this converted text file doesn't work with this script. Anyhow, I am sure, it would be much nicer, if I could parse the CVS file directly into that script

    But how?

    Sorry, I can't get any further on my own.

    better

    P.S: This is what I added to your script

    use File::Basename; use File::Copy; ... ... ... ... my $dirTarget = '/cygdrive/d/tmp/'; copy ($_, $dirTarget.basename ("$_")) for (@fnames);
Re^4: Looking up elements of an array in another array!
by better (Acolyte) on Mar 17, 2013 at 17:01 UTC

    The scripts works now! It was not the encoding, but the carriage return, which was included in the "bad" text file. Monk McA came up with reading the text file in a hex code. After stripping of the carriage return from each ID, the IDs could be handed over as regex into your code. And voilą, a couple of thousand files had been found and copied.

    Thanks again! That saved me a lot of time.

    I'm feeling much

    better ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (20)
As of 2014-08-22 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (163 votes), past polls