Hello Ken, please CC your replies to the mailing list, as I specifically request in the last line of my signature. I am CCing my reply.
On Sun, 27 May 2012 23:12:20 -0700 Ken Furff <frazzmata...@gmail.com> wrote: > I dont understand this syntax completely > > my @indexes = (2 .. (2+4-1)); > my @desired_cells = @{ $sheet->{Cells}[$row] }[ @indexes ]; > > not sure what I am loading into the @indexes array on that first line, You are loading all the indexes from 2 to (2+4-1) namely «(2,3,4,5)». 2+4-1 indicates 4 indices starting from 1. > I > know somehow I am trying to tell it what column to grab, but it doesn't > make sense to me completely. Can you break it down a little for me, if you > have time The @{ $array_ref_expr }[ @indexes] is an array slice. For more information, see the links on: http://perl-begin.org/topics/references/ Regards, Shlomi Fish > > On Fri, May 25, 2012 at 5:17 AM, Shlomi Fish <shlo...@shlomifish.org> wrote: > > > Hi Ken, > > > > On Thu, 24 May 2012 08:41:36 -0700 (PDT) > > Ken Furff <frazzmata...@gmail.com> wrote: > > > > > I am using the spreadsheet::xlsx module in a script im writing. I need > > to extract about 4 columns out of about 60. I need those specific columns > > for comparison and updating. I assume that I'll load the data into an array > > or an array of arrays for comparison. I am able to extract the contents of > > the file, but I cant figure out how to specify just those columns... I'll > > put the code i currently have below > > > > > > use Spreadsheet::XLSX; > > > > > > $excel = Spreadsheet::XLSX -> new ('build.xlsx'); > > > foreach my $sheet (@{$excel -> {Worksheet}}) { > > > > > > printf("Sheet: %s\n", $sheet->{Name}); > > > $sheet -> {MaxRow} ||=$sheet -> {MinRow}; > > > > > > foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) { > > > > > > $sheet -> {MaxCol} ||= $sheet -> {MinCol}; > > > > > > foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol}) { > > > > > > $cell = $sheet -> {Cells} [$row] [$col]; > > > > > > > Here you can filter or extract the relevant items out of > > @{ $sheet->{Cells}[$row] }. > > > > You can do something like: > > > > my @indexes = (2 .. (2+4-1)); > > my @desired_cells = @{ $sheet->{Cells}[$row] }[ @indexes ]; > > > > For more information, see: > > > > http://perl-begin.org/topics/references/ > > > > Regards, > > > > Shlomi Fish > > > > -- > > ----------------------------------------------------------------- > > Shlomi Fish http://www.shlomifish.org/ > > My Aphorisms - http://www.shlomifish.org/humour.html > > > > The KGB used to torture their victims by having them look at scrolling XSLT > > code. > > > > Please reply to list if it's a mailing list post - http://shlom.in/reply . > > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ What Makes Software Apps High Quality - http://shlom.in/sw-quality Larry Wall has been changing the world. By modifying its very source code. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/