Hello:
On Sat, Dec 31, 2011 at 02:56:50AM +0200, Igor Dovgiy wrote:
> $filedata{$_} = [$filesize, $filemd5];
*snip*
> my ($size, $md5) = @{ $filedata{$filename} };
Alternatively, store a nested hash-reference:
$filedata{$File::Find::name} = {
md5 => $file_md5,
size => $file_s
Hi folks, happy new year to everyone. )
John, you're right, of course. ) The filenames in nested directories could
well overlap, and using $File::Find::name would be safer.
Didn't think of that as a big problem, though, as original script (with
'opendir') ignored all the nested folders overall.
J
On Sat, Dec 31, 2011 at 4:29 AM, John W. Krahn wrote:
> Igor Dovgiy wrote:
>
>> Great work, Jonathan!
>> Notice how simple your script has become - and that's a good sign as well
>> in Perl. :) We can make it even simpler, however.
>>
>> As you probably know, Perl has two fundamental types of col
Igor Dovgiy wrote:
Great work, Jonathan!
Notice how simple your script has become - and that's a good sign as well
in Perl. :) We can make it even simpler, however.
As you probably know, Perl has two fundamental types of collections: arrays
(where data is stored as a sequence of elements, data c
Great work, Jonathan!
Notice how simple your script has become - and that's a good sign as well
in Perl. :) We can make it even simpler, however.
As you probably know, Perl has two fundamental types of collections: arrays
(where data is stored as a sequence of elements, data chunks) and hashes
(wh
On Fri, Dec 30, 2011 at 7:11 PM, Brandon McCaig wrote:
> On Thu, Dec 29, 2011 at 03:43:19PM +, Jonathan Harris wrote:
> > Hi All
>
> Hello Jonathan:
>
> (Disclaimer: I stayed up all night playing Skyrim and am running
> on about 4.5 hours of sleep.. ^_^)
>
> I think most things have already b
On Thu, Dec 29, 2011 at 03:43:19PM +, Jonathan Harris wrote:
> Hi All
Hello Jonathan:
(Disclaimer: I stayed up all night playing Skyrim and am running
on about 4.5 hours of sleep.. ^_^)
I think most things have already been addressed, but I think Igor
might have had a bit of trouble making i
On Fri, Dec 30, 2011 at 11:58 AM, Igor Dovgiy wrote:
> Hi John, yes, good point! Totally forgot this. ) Adding new files to a
> directory as you browse it is just not right, of course. Possible, but not
> right. )
>
> I'd solve this by using hash with filenames as keys and collected 'result'
> st
Hi John, yes, good point! Totally forgot this. ) Adding new files to a
directory as you browse it is just not right, of course. Possible, but not
right. )
I'd solve this by using hash with filenames as keys and collected 'result'
strings (with md5 and filesizes) as values, filled by File::Find tar
Hi Jonathan,
Argh, really stupid mistake by me. ) But let's use it to explain some
points a bit further, shall we?
A skilled craftsman knows his tools well, and Perl programmer (with CPAN as
THE collection of tools of all sizes and meanings) has an advantage here: even
if documentation is a bit va
Jonathan Harris wrote:
FInally, I was advised by a C programmer to declare all variables at the
start of a program to avoid memory issues
Is this not necessary in Perl?
It is not really necessary in C either.
John
--
Any intelligent fool can make things bigger and
more complex... It takes
Jonathan Harris wrote:
On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote:
Igor made a lot of good points. Here are my two cents worth. You are
using the File::Find module to traverse the file system and add new files
along the way. This _may_ cause problems on some file systems. It would
On Fri, Dec 30, 2011 at 12:33 AM, Jonathan Harris
wrote:
>
>
> On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote:
>
>> Jonathan Harris wrote:
>>
>>>
>>> Hi Igor
>>>
>>> Many thanks for your response
>>>
>>> I have started reviewing the things you said
>>> There are some silly mistakes in there
On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote:
> Jonathan Harris wrote:
>
>>
>> Hi Igor
>>
>> Many thanks for your response
>>
>> I have started reviewing the things you said
>> There are some silly mistakes in there - eg not using closedir
>> It's a good lesson in script vigilance
>>
>> I
Jonathan Harris wrote:
Hi Igor
Many thanks for your response
I have started reviewing the things you said
There are some silly mistakes in there - eg not using closedir
It's a good lesson in script vigilance
I found the part about opening the file handle particularly interesting
I had no idea
On Thu, Dec 29, 2011 at 5:08 PM, Igor Dovgiy wrote:
> Hi Jonathan,
>
> Let's review your script a bit, shall we? )
> It's definitely good for a starter, but still has some rough places.
>
> #!/usr/bin/perl
>> # md5-test.plx
>> use warnings;
>> use strict;
>>
> use File::Find;
>>
> use Digest::MD
Hi Jonathan,
Let's review your script a bit, shall we? )
It's definitely good for a starter, but still has some rough places.
#!/usr/bin/perl
> # md5-test.plx
> use warnings;
> use strict;
>
use File::Find;
>
use Digest::MD5;
> use File::Spec;
>
So far, so good. )
> my $dir = shift || '/Users/j
Hi All
Firstly, many thanks for your help previously (19/12/11) - it has led to
making a useable script
I don't think it's brilliantly written, it seems a little bodged together
to me... but works fine - not a bad result for a first script
If you are new to this problem and are interested in
18 matches
Mail list logo