in reply to variable scopes in Excel::Writer::XLSX

Hi johnrcomeau,
Really, I can't figure what you really wanted to use, however you can use this: [the code below actually works]

use warnings; use strict; use Excel::Writer::XLSX; func(@ARGV); sub func { my $file = 'perl.xlsx'; my $book = Excel::Writer::XLSX->new($file); my $worksheet = $book->add_worksheet(); my $closure_workbook; if (@_) { $closure_workbook = sub { $worksheet->write_col( 0, 0, [@_] ); }; return $closure_workbook->(@_); } else { $worksheet->write( 0, 0, 'Hi Excel!' ); } }

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me