Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Spreadsheet::XLSX Cell Access

by runrig (Abbot)
on Sep 12, 2013 at 22:05 UTC ( #1053805=note: print w/ replies, xml ) Need Help??


in reply to Spreadsheet::XLSX Cell Access

Obligatory link: http://perl.plover.com/varvarname.html.

Use a hash:

my %yield; $yield{$_} = $sheet->{"${_}35"} for "F".."K"; #or $yield{$_} = $sheet->{ $_ . 35 } for "F".."K";


Comment on Re: Spreadsheet::XLSX Cell Access
Download Code
Re^2: Spreadsheet::XLSX Cell Access
by Hammer2001 (Novice) on Sep 13, 2013 at 00:10 UTC
    Runrig et el, thanks for your quick replies.

    Runrig, how do declare an array of hashes? In your snippet "my %yield;" will only declare a single hash whereas I need 6 of them.

    I can testify that

    my %pond$_ for "F".."K";

    does not work.

    Thanks,

    Hamid

      Runrig et el, thanks for your quick responses. Runrig, how do I declare an array/series of hashes? In your snippet "my %yield;" will only declare a single hash whereas I need 6 of them.

      I can testify that

      my %pond$_ for "F".."K";

      does not work.

      Thanks,

      Hamid

      PS. Sorry for erroneously starting a new thread.

        An array of hashes is declared as a simple array:

        my @pond;

        Then to use it, one possible way is this:

        $pond[$i]{$_} = 'foo';

        But from what you have shown, you only need a single hash as follows:

        $yield{$_} = 'bar';

        Read the link that has been provided to you in an earler post.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053805]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2015-07-06 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls