Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 908667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:45:13+00:00 2026-05-15T16:45:13+00:00

the following perl script (Showing down) print the following XML file but the XML

  • 0

the following perl script (Showing down)

print the following XML file
but the XML have problem because the unnecessary “&#10” char after TEST word

 <ROOT>
     <FILE Name="TEST1&#10;"/>
     <FILE Name="TEST2&#10;"/>
     <FILE Name="TEST&#10;"/>ar
</ROOT>

I think the “&#10” characters its because the linebreak (read the output of a command into @myNames with the backtick operator)
it seems that this problem of existing “&#10” in my XML can be solved chomp command

my question: in which way need to add the chomp command in my script in order to solve the problem

my perl script

#!/usr/bin/perl

use warnings;
use XML::LibXML;


my $doc  = XML::LibXML::Document->new; 
my $root = $doc->createElement('ROOT');
$doc->setDocumentElement($root);


my @myNames=` ls /var/tmp | grep FILE.xml | sed "s/.FILE.*//"  `;

foreach (@myNames) {

my $objVar = $doc->createElement('FILE');
$root->appendChild($objVar);
$objVar->setAttribute('Name' , $_ );

} 


my @lines = split /\n/, $doc->toString(1);
shift @lines;

foreach (@lines) {

print "$_\n";
}

the files under /var/tmp

   TEST1-FILE.xml
   TEST2-FILE.xml
   TEST-FILE.xml
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:45:13+00:00Added an answer on May 15, 2026 at 4:45 pm

    Go ahead and use it immediately after you get the list of filenames:

    my @myNames=` ls /var/tmp | grep FILE.xml | sed "s/.FILE.*//"  `;
    chomp(@myNames);
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create the following XML file, by perl script (Showing down) , using XML::LibXML:
I wrote the following Perl script (below) in order to create simple XML file.
I have an interesting problem. I wrote the following perl script to recursively loop
Let's say I have the following simple script: print ID : ; $ID =
I have the following Perl script that generates a string based on a number:
I have the following perl script that works locally given the input parameters. I
I have to maintain the following Perl script: #!/usr/bin/perl -w die Usage: $0 <file1>
Consider the following perl script ( read.pl ): my $line = <STDIN>; print Perl
I have the following Perl script counting the number of Fs and Ts in
I have the following Perl script. I am trying to run it in Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.