Bea*_*ard 0 xml perl perl-data-structures
我正在使用Perl程序,只需使用打开,打印,关闭的典型函数就可以写入XML文件.XML文件稍后由PHP Web应用程序消化.
#!/usr/bin/perl
#opening file
open FILE, ">derp.xml" or die $!;
#data is created in variables like so...
$first = '<\?xml version=\"1.0\" encoding=\"UTF-8\" \?>';
$openperson = '<person>\n';
$name = '<name>Gary</name>\n';
$birthday = '<brithday>01/10/1999</birthday>\n';
$car = '<car>minivan</car>\n';
$closeperson = '</person>\n';
#writing variables to file
print FILE $first;
print FILE $openperson;
print FILE $name;
print FILE $birthday;
print FILE $car;
print FILE $closeperson;
close FILE;
Run Code Online (Sandbox Code Playgroud)
或多或少这基本上是当前系统的工作方式.我相信一定有更好的方法.
这些CPAN模块是什么:
| 归档时间: |
|
| 查看次数: |
1293 次 |
| 最近记录: |