Rob Richardson wrote:
>
> Hello again.
Hello,
> None of this is working.
>
> John Krahn suggested:
> > push @{$trainsList{$trainDate}}, @trainData;
> (note the curly brackets on the outside). This gave me the following
> error:
>
> Can't locate object method "trainList" via package "trainDate" (perhaps
> you forgot to load "trainDate"?) at
> c:\INDIGO~1\HTDOCS\CREW\CALENDAR.CGI line 242, <SCHEDULE> line 1.
>
> Beau Cox suggested:
>
> > push @( $trainsList{$trainDate} }, $trainRef;
> In this line, the @ is followed by a parenthesis while the comma is
> preceded by a curly bracket. I presumed they both should have been
> parentheses. When I try it, I get:
> syntax error at c:\INDIGO~1\HTDOCS\CREW\CALENDAR.CGI line 244, near
> "@($trainsList"
> syntax error at c:\INDIGO~1\HTDOCS\CREW\CALENDAR.CGI line 259, near "}"
> I have no idea why this construct should cause Perl to be confused
> about the closing bracket at the close of my program.
>
> If I try it without brackets or parentheses:
> > push @$trainsList{$trainDate}, $trainRef;
>
> I get:
> Type of arg 1 to push must be array (not hash slice) at
> c:\INDIGO~1\HTDOCS\CREW\CALENDAR.CGI line 244, near "$trainRef;"
>
> What's going on? How can I push my reference into an array to which I
> only have access through a reference?
It looks like you are having problems with references and complex data
structures (and maybe error messages as well.) Perl includes a lot of
documentation to explain all these things, usually through the perldoc
program. From a commmand line prompt try running these commands:
perldoc perlreftut
perldoc perlref
perldoc perldata
perldoc perldsc
perldoc perllol
perldoc perldiag
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]