简体   繁体   中英

How to print two variable information to a same file

I am new to perl. I am extracting some nodes information from xml file and I need to print this information in a conman file.

open( my $file, '>', "data" )

while ( $reader->nextElement( 'info' )) {
      my $information= $reader->readOuterXml();

      $reader->nextElement( 'address' );
      my $address = $reader->readOuterXml();

      print $file "$information\n";

}

How to print $address information to the same $file . please help me with this.

print语句后添加以下行:

print $file "$address\n";
print $file "$information\n";
print $file "$address\n";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM