Hello, I've been googling about this operator
"||=", without success. Maybe I'm not reading it properly. I found it in perl module Spreadsheet::ParseExcel, in the samples folder, filename parse.pl. This is the fragment
(lines marked in red contain this operator):
Quote:
#!/usr/bin/perl
use strict;
use warnings;
use Spreadsheet::ParseExcel;
use Getopt::Long qw(GetOptions);
my $file;
my $help;
my $dump;
my ($row, $col);
GetOptions(
"file=s" => \$file,
"help" => \$help,
"dump" => \$dump,
"row=i" => \$row,
"col=i" => \$col,
) or usage();
usage() if $help;
usage() if not $file;
my $excel = Spreadsheet::ParseExcel::Workbook->Parse($file);
if ($dump) {
foreach my $sheet (@{$excel->{Worksheet}}) {
printf("Sheet: %s\n", $sheet->{Name});
$sheet->{MaxRow} ||= $sheet->{MinRow};
foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
$sheet->{MaxCol} ||= $sheet->{MinCol};
foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) {
my $cell = $sheet->{Cells}[$row][$col];
if ($cell) {
printf("( %s , %s ) => %s\n", $row, $col, $cell->{Val});
}
}
}
}
}
|
So far I've checked the values of variables before and after the operation, but I see no change.
Hope you can help me to understand its meaning.
Greetings.