my $data = "spamspamspamspamusefuldataspamspamspam"; print("Data: " . (map { s/spam//g;$_; } ($data))[0] . "\n"); #### if ($expected !~~ $got) { print("Smartmatch failed comparing data\n"); print("Expected:\n"); Devel::Peek::Dump $expected; print("Got:\n"); Devel::Peek::Dump $got; } #### Smartmatch failed comparing data Expected: SV = PV(0x3e57478) at 0x3e80f80 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0x356d5f0 "0.00"\0 CUR = 4 LEN = 8 Got: SV = PV(0x3e57498) at 0x3e9e4f0 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0xe0422e0 "0.00"\0 CUR = 4 LEN = 8 #### sub ReadXLS { my $ar_data; print("Reading from xls..."); $benchmark = Benchmark::timeit(1, sub { $ar_data = $interface->ExcelBinary_ReadData("$Incoming_Dir/items.xls"); }); print(scalar @{$ar_data} . " records in [" . $benchmark->real . " seconds], [" . (scalar @{$ar_data} / $benchmark->real) . " records/s]\n"); return $ar_data; } #### $Interfaces::ExcelBinary::Headers = []; # cell_handler (Workbook, Sheet_index, Row, Col, Cell) # Called by Spreadsheet::ParseExcel for every cell encountered. sub cell_handler { my ($workbook, $sheet_index, $row, $col, $cell) = @_; if ($row == 0) { push(@{$Interfaces::ExcelBinary::Headers}, $cell->value); } if ($row > 0) { Data::Dump::dd($Interfaces::ExcelBinary::Headers); $workbook->ParseAbort(1); exit; } } # ReadData (Filename, [WorkSheetID]) returns $ar_data # Reads data from the given file (which should be a BIFF-formatted .xls-file) and the given worksheet (by name or number (0-based)). # If the supplied worksheetID is a number, a negative number -n will refer to the n-to-last worksheet. sub ReadData { my ($self, $FileName, $WorkSheetID) = @_; my $ExcelParser = Spreadsheet::ParseExcel->new( CellHandler => \&cell_handler, NotSetCell => 1, ); print("Parsing\n"); my $WorkBook = $ExcelParser->parse($FileName); print("Done parsing\n"); exit; #### #!/usr/bin/perl use warnings; use strict; my $text1 = 'aapnootmies'; my $text2 = 'aapnogeenaap'; my $text3 = $text1 . reverse($text2); $text3 =~ s/(.*)(.*)(??{reverse $1})/$2/; print("Without common start [$text3]\n"); #### #!/usr/bin/perl use warnings; use strict; my $text1 = 'aapnootmies'; my $text2 = 'aapnogeenaap'; my $text3 = $text1 . reverse($text2); $text3 =~ m/(.*)(.*)(??{quotemeta reverse $1})/s; my $common = $1; $text1 =~ s/^\Q$common//; $text2 =~ s/^\Q$common//; print "[$text1]\n[$text2]\n";