in reply to Re: Regular Expressions Matching with Perl
in thread Regular Expressions Matching with Perl

Unfortunately, I think substr will fail when the raw size of the file is 10MB of more, when the compressed size of the file is 10MB or more, or when the compression ratio is 100%. (I've seen it round to 100% once.)

Replies are listed 'Best First'.
Re^3: Regular Expressions Matching with Perl
by NateTut (Deacon) on Apr 20, 2005 at 18:57 UTC
    You wouldn't need to run substr on the whole file at one time, you would run it against each line of the file separately like this:
    use strict; use warnings; use Data::Dumper; my @Temp; use constant FileNameStart => 58; while(<DATA>) { chomp(); push(@Temp, substr($_,FileNameStart)); } print(Dumper(@Temp)); __DATA__ 0 Stored 0 0% 04-20-05 08:43 00000000 test 1 2 3.z +ip 704106 DeflatN 83362 89% 04-04-05 19:00 8e76dc22 file1.dat

      I was talking about the size of the file in the archive, not the size of the output.

      For example, add:
      10000000  DeflatN  83362  89%  04-04-05  19:00  8e76dc22   file2.dat
      or
       704106  DeflatN  4      100%  04-04-05  19:00  8e76dc22   file3.dat
      to your __DATA__ and you'll notice an extra space in front of the file name. Now, I'm not sure how his unzip program handles these cases, so substr may actually work.