Re: Converting XML to MARC without reading a file?
[email protected] (Bruce Van Allen) Wed, 18 Apr 2018 19:13:02 -0700
| Newsgroups | perl.perl4lib |
|---|---|
| Message-ID | <[email protected]> |
On 4/18/18 at 5:25 PM, [email protected] (Andy Kohler) wrote: >Do I have to write the XML to a file, then read it in again to convert it? >Or am I just missing something obvious? Perl lets you open a reference to a scalar variable as a file. #!/usr/bin/perl use strict; use warnings; my $string =3D "line 1\nline 2\nline 3\n"; open my $fh, "<", \$string; while (<$fh>) { print "Printing $_"; } close $fh; # Printing line 1 # Printing line 2 # Printing line 3 $fh is a filehandle like any other. Can you use that? HTH --=20 - Bruce _bruce__van_allen__santa_cruz__ca_