#
# hash_sf($row_data,'field'[,'subfield'])
#
# e.g. hash_sf($row,'700','a')
#
sub hash_sf {
	my $row = shift @_;
	my $field = shift @_;
	my $subfield = shift @_;

	my $i = shift @_ || 0;

	my $out;

	if ($row->{$field}->[$i]) {
		if (! $subfield) {
			# subfield list undef, empty or no defined subfields for this record
			my $all_sf = $row->{record}->{$field}->[$i] || confess "can't find field $field:$i",Dumper($row);
			$all_sf =~ s/[\^\$]./ /g;   # nuke definitions
			return $all_sf;	
		}
		my $sf = $row->{$field}->[$i]->{$subfield};
		return $sf if ($sf);
	}
}

1;

