If you use i.e. the String::CRC32 module, just use the incremental form $crc=crc32($additionalString,$crc) starting with $crc=0;. Finally, $crc is a 32bit unsigned integer value that can be compared. Maybe you need a conversion into a hex-notation or something beforehand (Edit: I mean before comparison, if you have to compare against some string format.): $clear=sprintf("%X",$crc); or $clear=uc(unpack("H8", pack("N",$crc))); | [reply] [d/l] [select] |
my $data = do { local( $/ ) ; <$XmlFile> } ; # Slurp file
$data =~ s!(^\s*)?\<(TotalAmount|NoOfRecords|TotalBatch|CurrentBatch|E
+ODTransactionDate|BankFileSeqNo|TotAmount)\>(.+?)\<\/\1\>\n?!!mig;
+# Zap headers
$data =~ s!(^\s*)?</?.*?>\n?!!mig; # Zap xml tags
CRC32($data); # CRC remaining data
Should be fast, but in general regex'ing x/html is fragile and NOT recommended.
(implicit assumptions about the data content is one of the traps, -- which may/not apply in your case).
You probably should use XML::Twig instead!
| [reply] [d/l] |