my $date = $ARGV[0]; $date or $date = `date --date='1 hour ago' +%Y-%m-%d`; chomp $date;
In this code if the "$date" is NULL then its taking the system date.
But in this code if the hash element is NULL I need to write '0'. For that I tried this way
foreach my $sub_user_error (@db_user_errors) { $worksheet->write( $row, $col, $db_error_data{$hour}{'Submissio +n_user_error'}{$sub_user_error} or 0, $number); $col++; } $row++;
But its not working. Later I tried like
foreach my $sub_user_error (@db_user_errors) { if ($db_error_data{$hour}{'Submission_user_error'}{$sub_user_erro +r} eq "") { $worksheet->write( $row, $col, 0, $number); $col++; } else { $worksheet->write( $row, $col, $db_error_data{$hour}{'Submiss +ion_user_error'}{$sub_user_error}, $number); $col++; } } $row++;
Its working but seems too ugly. Is there any better way for doing this.
Thanks in Advance for helping
In reply to Need help with Excel::Writer::XLSX in using 'or' by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |