aerris has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Fcntl; #The Module print "Series:\n"; $series = <>; print "Filename:\n"; $filename = <>; open (XMLFILE,">c:/Perl_Tests/temp.xml"); printf XMLFILE '<?xml version="1.0" encoding="UTF-8"?>\n'; printf XMLFILE '<XML TAGS>'; printf XMLFILE '<SERIES>'.$series.'</SERIES>'; printf XMLFILE '<ETC>'.$etc.'</ETC>'; printf XMLFILE '<ETC>'.$etc.'</ETC>'; printf XMLFILE '</XMLTAGS>'; close(XMLFILE);I want the use to specify the filename (instead of temp.xml) but I can't get the value of $filename into that path: eg
open (XMLFILE,">c:/Perl_Tests/".$filename.".xml");or something like that. Can anyone help? Also... I want to put carriage returns after each line of XML so when the outputted file is view in a text editor it is easier to read... I can create the file and enter the XML into it - i just cant specify the name of the file during the program execution... i have to rename it aftewards. Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Specifying filename
by Corion (Patriarch) on Jun 12, 2008 at 12:10 UTC | |
|
Re: Specifying filename
by apl (Monsignor) on Jun 12, 2008 at 12:01 UTC | |
|
Re: Specifying filename
by pseudomonas (Monk) on Jun 12, 2008 at 12:11 UTC | |
|
Re: Specifying filename
by toolic (Bishop) on Jun 12, 2008 at 12:58 UTC | |
|
Re: Specifying filename
by jeepj (Scribe) on Jun 12, 2008 at 12:12 UTC | |
by psini (Deacon) on Jun 12, 2008 at 13:17 UTC | |
by mlawren (Sexton) on Jun 15, 2008 at 09:24 UTC | |
|
Re: Specifying filename
by Anonymous Monk on Jun 15, 2008 at 18:15 UTC |