in reply to Reading arrays

It's hard to guess what you've got, but I'm thinking perhaps you've got an array ref in a variable and you're trying to read the data from a plain array.

In that case you'll have to dereference the array ref. Perl will never automatically dereference for you.

@geo = @$geo;

Replies are listed 'Best First'.
Re^2: Reading arrays
by joe_fubar (Initiate) on Feb 27, 2011 at 17:20 UTC

    Hi Folks,

    thanks realy much for helping, dereference the array did the trick, this is what i have, maybe not very fashioned but it works:

    #! /usr/bin/perl use strict; use warnings; use Data::Dumper; my @final; my @geo; my $derefrecord; use Win32::OLE; #Used for Geosearch and Currency my $fso = Win32::OLE->new("HHCOM.GeoSearch.CircleRangeSearch"); @geo = $fso->FindLocationsInCircleRange("CGN",75) ; print Dumper(@geo); foreach my $records (@geo){ print "=>@$records<=\n"; $derefrecord="@$records"; } print "$derefrecord\n"; my @GEORECORD = split(" ", $derefrecord); foreach (@GEORECORD){ print "$_\n"; } Output of print Dumper(@geo); $VAR1 = [ 'BNJ', 'CGN', 'DUS', 'ESS', 'GKE', 'MGL', 'SGE', 'WID' ];

    Output of print "=>@$records<=\n";

    =>BNJ CGN DUS ESS GKE MGL SGE WID<=

    Output foreach (@GEORECORD){print "$_\n"; ...

    BNJ CGN DUS ESS GKE MGL SGE WID

    Thanks again Joe