Re: Need your help to achieve this?

2006-10-10 Thread Eric Waguespack
this sounds like a perfect use for a hash %month = ( 1 => "Jan", 2 => "Feb", ); print $month{"1"}, "\n"; On 10/10/06, Goke Aruna <[EMAIL PROTECTED]> wrote: i want to process the attached file and i want to replace the $data[1] with equivalent month is strings. i have this code but

Re: iterate through and array?

2006-10-10 Thread Eric Waguespack
sorry, now I am spamming :) perl -e '$tring="spam"."ringtones"."text"; if ( $tring =~ m/qwerty/ ){print "spam\n"}' perl -e '$tring="spam"."ringtones"."text"; if ( $tring =~ m/spam|ringtones|etc/ ){print "sp

Re: iterate through and array?

2006-10-10 Thread Eric Waguespack
there is also grep perl -e '@rray = ("this", "is", "a", "test", "spam"); print (grep /bad|yuk|ugly|spam/, @rray)' On 10/10/06, Charles Farinella <[EMAIL PROTECTED]> wrote: Tom Phoenix wrote: > It's hard to say for sure why it's not working, without seeing what > you're trying to do. But

Re: iterate through and array?

2006-10-10 Thread Eric Waguespack
I am sure someone else can do it better, but how about the following? foreach (@rray){ if (/match/) {print "yay";} } On 10/10/06, Charles Farinella <[EMAIL PROTECTED]> wrote: How can I iterate through an array and if I find a match do something without doing that thing for every element in th

check for duplicate files that are truncated

2006-10-06 Thread Eric Waguespack
Hi, I am new to the list, so I apologise if I do anything wrong :) I made the script below to check files that are duplicates but I only want to check the first few bytes (perhaps 1-10k, depending on false positives) I would like to convert it to native perl, can someone give me some pointers?