SPUG: Symbolic references ???

Peter Darley pdarley at kinesis-cem.com
Wed Jan 25 14:09:39 PST 2006

    What you're doing here is setting $lc_table to be a refrence to an
anonymous array, rather than using the name in $lc_table to determine where
the data goes.
    You could use an eval:

eval("push \@$lc_table, \"rep bla bla bla bla bla\";");

    Note: Someone's going to bitch about the parens not doing anything, but
they make it easier for me to read, so there! :)

Peter Darley
  -----Original Message-----
  From: spug-list-bounces at pm.org [mailto:spug-list-bounces at pm.org]On Behalf
Of Orr, Chuck (NOC)
  Sent: Wednesday, January 25, 2006 12:50 PM
  To: spug-list at pm.org
  Subject: SPUG: Symbolic references ???


  I have a group of 5 arrays, named as follows:

  my @ofcrte;
  my @pxrte;
  my @acrte;
  my @farte;
  my @ftrte;

  I would like to push something on to one of them per iteration of a loop,
the pushee determined by a variable named $lc_table.

  If I read pgs 16 & 17 of the leopard (advanced perl programming)
correctly, I should be able to use a symbolic reference to push to the
appropriate array depending on the contents of the $lc_table variable.  I
have turned strict refs off within the loop.

  here is my push line:

  push @$lc_table, "rep bla bla bla bla bla";

  when I then print the above listed arrays, they have nothing in them.
However, if I print "@$lc_table"; within the loop, there are elements in the
array.  Any suggestions?

  If anyone can help me and has time to look at a little more code, I would
be glad to send it.

  Thanks for your help,
  Chuck Orr
  chuck.orr at cingular.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20060125/17e285a6/attachment.html

More information about the spug-list mailing list