On Wednesday, September 08, 2010 3:51 PM, Justin Rittenhouse [mailto:jritt...@nd.edu] wrote: >I'm relatively new to Perl and very new to the MARC::Record module. I'm >trying to use the subfields function (my @subfields = $field->subfields();), >but I'm getting an error: >Can't use an undefined value as an ARRAY reference at >/usr/lib64/perl5/vendor_perl/5.8.8/MARC/Field.pm line 275. >I'm not familiar enough with Perl to figure out what the function is actually >doing, so I can't figure out if this is a bug or if I missed something in the >tutorial. Other functions off of the $field variable work (I can pull the >tag, indicator, and as_string functions).
It's difficult to say what went wrong without a little more context. In MARC::Lint, to access the subfields of a field, the following code appears fairly frequently to break down the subfields into code+data pairs in an array: #where $field is a MARC::Field object my @subfields = $field->subfields(); my @newsubfields = (); while (my $subfield = pop(@subfields)) { my ($code, $data) = @$subfield; unshift (@newsubfields, $code, $data); } # while ############### What does your code look like in the area that is producing the error? Thank you, Bryan Baldus bryan.bal...@quality-books.com eij...@cpan.org http://home.comcast.net/~eijabb/