$names{ $resource->{url} } ||= File::Spec->catfile( $target_dir, $names{ $resource->{url} }); my $target = $names{ $resource->{url} } or die "Don't have a filename for URL '$resource->{url}' ?!"; $s->log( 'debug', "Saving '$resource->{url}' to '$target'" ); open my $fh, '>', $target or croak "Couldn't save url '$resource->{url}' to $target: $!"; binmode $fh; print $fh $resource->{content}; CORE::close( $fh );