Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl crashes at 128KB?

Reply
Thread Tools

Perl crashes at 128KB?

 
 
Kelvin
Guest
Posts: n/a
 
      09-14-2004
Hi, there:

Following is my code, basically I try to simply XOR a 20MB file line by line
with a key
then save it in a file. I am using the lastest ActivePerl in Win2000.

The error I got is,
The instruction at "0x2808698b" referenced memory at "0x00000004".
The memory couldn't be "written".

Click OK to terminate...
Click CANCEL to debug...

What happened?

Thanks.




#!/usr/bin/perl
use POSIX;

open(FIL, "./line_merged.all");
@page_in = <FIL>;
close(FIL);

$key = "This is my key";
$j = 0;
open(FIL, ">./encrypted.all");
binmode FIL;
foreach $line (@page_in) {
if( $j % 100 == 0 ) {
print "\n\n\nLine $j started here: \n";
print "\n" . $line;
}
$j = $j + 1;
$mult = ceil( length( $line ) / length( $key ) ) + 1;
for( $i = 0; $i < $mult; $i = $i + 1) {
$key = $key . $key;
}
$key = substr($key, 0, length($line));
$line = $key ^ $line ;
# print "\n" . $key;
# print "\n\nAfter Encryption\n" . $line;
print FIL $line;

# $line = $key ^ $line ;
# print "\n\nAfter Decryption\n" . $line;
}
close(FIL);


 
Reply With Quote
 
 
 
 
Ejner Borgbjerg
Guest
Posts: n/a
 
      09-20-2004
Hi Kelvin

I've used Active Perl some years on my job. Your code looks quite ordinary
to me. I nearly always use strict and use warnings though.

use POSIX I've never used. What does it do ?

regards Ejner


On Tue, 14 Sep 2004 10:24:56 +0800, Kelvin wrote:

> Hi, there:
>
> Following is my code, basically I try to simply XOR a 20MB file line by line
> with a key
> then save it in a file. I am using the lastest ActivePerl in Win2000.
>
> The error I got is,
> The instruction at "0x2808698b" referenced memory at "0x00000004".
> The memory couldn't be "written".
>
> Click OK to terminate...
> Click CANCEL to debug...
>
> What happened?
>
> Thanks.
>
>
>
>
> #!/usr/bin/perl
> use POSIX;
>
> open(FIL, "./line_merged.all");
> @page_in = <FIL>;
> close(FIL);
>
> $key = "This is my key";
> $j = 0;
> open(FIL, ">./encrypted.all");
> binmode FIL;
> foreach $line (@page_in) {
> if( $j % 100 == 0 ) {
> print "\n\n\nLine $j started here: \n";
> print "\n" . $line;
> }
> $j = $j + 1;
> $mult = ceil( length( $line ) / length( $key ) ) + 1;
> for( $i = 0; $i < $mult; $i = $i + 1) {
> $key = $key . $key;
> }
> $key = substr($key, 0, length($line));
> $line = $key ^ $line ;
> # print "\n" . $key;
> # print "\n\nAfter Encryption\n" . $line;
> print FIL $line;
>
> # $line = $key ^ $line ;
> # print "\n\nAfter Decryption\n" . $line;
> }
> close(FIL);


 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      09-20-2004
Ejner Borgbjerg wrote:

> I've used Active Perl some years on my job. Your code looks quite ordinary
> to me. I nearly always use strict and use warnings though.
>
> use POSIX I've never used. What does it do ?


perldoc POSIX

-Joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 02-03-2011 11:00 AM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 01-23-2011 05:00 AM
James Gosling the Creator of EMACS and JAVA - leaves ORACLE - Butthen reports started coming in of odd failures. Systems would crashstrangely. We'd get crashes in applications. All applications. Crashes in thekernel. small Pox C Programming 2 07-22-2010 10:07 PM
Perl crashes Steve Butler Perl Misc 7 12-04-2004 09:54 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments