#
# marc_sf($marc,'field'[,'subfield'])
#
# e.g. marc_sf($row,'700','a')
#
sub marc_sf {
	my $marc = shift @_ || die "marc_sf: needs record";
	my $f = shift @_ || die "marc_sf: needs field name";
	my $s = shift @_;

	my $i = shift @_ || 0;

	my @out;
	if ($s) {
		@out = $marc->subfield($f,$s);
	} else {
		@out = $marc->field($f)->as_string() if ($marc->field($f));
	}

	return $out[$i] if (@out && $out[$i]);
}

1;

