Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!hplabs!hpl-opus!hpnmdla!chrise From: chrise@hpnmdla.HP.COM (Chris Eich) Newsgroups: comp.lang.perl Subject: shift within eval gives null? Message-ID: <8310006@hpnmdla.HP.COM> Date: 15 Aug 90 01:58:27 GMT Organization: HP Network Measurements Div, Santa Rosa, CA Lines: 26 I'm using perl 3.0pl18. Consider the following: ------------------------------------------------------------------------ # List of arrays containing values that occur once per file. @PerFile = ('FileName', 'FileSize', 'DateWritten', 'RetryDensity', 'DataHost', 'TapeHost', 'WriteCommand'); sub main'AddToToc { # &AddToToc(); local($[) = 1; # So we can index arrays by $FileNumber. # Update the per-file values with the subroutine arguments. $FileNumber++; foreach (@PerFile) { eval '$' . $_ . "[$FileNumber] = shift"; } } ------------------------------------------------------------------------ When I call AddToToc with seven values, I'd like the first element of each of the per-file arrays to be set to the respective value. It doesn't happen. The elements are set to null. Doesn't shift (of the subroutine arguments @_) work within an eval? Chris