I was just trying to get at 2 fields and change the data without having to create a new object. Which I did anyway...

I alway use strict. Yes it throws errors which just told me I wasn't accessing the structure right. But I already knew that. :)

References eat my lunch anyway. I use objects to dodge them to avoid @{}->[]->{} crap. So when I have to work with them(refs) I am always lost. my solution was as follows

$Query_Statement="select fname,lname,address,city,state,zip,phone,emai +l FROM main order by lname,fname;"; my $sth = $dbh->prepare($Query_Statement); $sth->execute(); my @array; my $dataObjRef = \@array; while( my $array_ref = $sth->fetchrow_arrayref){ #print ">>@$array_ref\n"; my $fname = $array_ref->[0]; my $lname = $array_ref->[1]; my $total += length($fname); my $total += length($lname); if ((length($fname) + length($lname)) > 18){ my $Fintial = substr($fname,0,1); if ((length($Fintial) + length($lname)) > 18){ $lname = substr($lname,0,16); } $array_ref->[0] = $Fintial; $array_ref->[1] = $lname; #print "$Fintial $lname\n"; } else{ next; } my @newArray = @$array_ref; push(@$dataObjRef, \@newArray); } $sth->finish(); $dbh->disconnect or warn "Disconnection failed: $DBI::errstr\n"; return $dataObjRef; }

In reply to Re^2: accessing data in DBI object by arcnon
in thread accessing data in DBI object by arcnon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.