It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am trying to create hash table using perl. I have XML file as input and it contains information about diognostic tests and test description. Test number as a key and Test description as a value to the key. Then test number and string have the key -value relation.Help me to write perl script that stores description in one string and create hash table.please can help me because i am begginer to perl and i am reading but i am not able to implement.
<DATA>
<number>1</number>
<age>24</age>
<place>india</place>
<description></description>
</data>
That's pretty much what XML::Simple does. So just use that.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have one module, such as A.pm, in this A.pm, it will read and write one certain conf file, such A.conf.
Now in my perl script file: 1_perl.pl, I use A.pm to reset certain value in A.conf file and also use A.pm to write this value in 2_perl.pl. So my question is how to hand this process in background? It will produce 2 A.pm instance to handle this or just one instance ?
Please give more details about this , thank you in advance
Perl modules are just loadable blobs of functions and data -- modules are not processes, so your question doesn't really make sense.
If you want your module to create a background process to write out the configuration file, that's certainly doable, but you'll have to implement it yourself. Deciding how to manage these processes is up to you.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
here Im writing a perl program which to parse a file, it contians multiple line, in each line it has three fields: name, size in bytes and user.
any sample code to validates the file? for example, if I want to check if a given file through argument that it is validate file?
If this is a CSV file use a CSV parser
For eg.
http://perlmeme.org/tutorials/parsing_csv.html
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to process a txt file using perl. I have succeeded in using this perl code to process wikipedia txt file before, so it is correct. But when I run the perl code, there appears an error:
utf8 "\xA1" does not map to Unicode at xxx
I check the txt file. There is \xA1 characters in it. I tried to remove those "\xA1" with RegEx s/(\xa1)+//g; but failed.
So what is the problem and how can I solve this?
At last, I revise my code. I use
binmode( IN, ':stdio' );
instead of
binmode( IN, ':utf8' );
and it works.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am new to Perl, and I need to write a Perl script to compare two files which shows the matched and unmatched content in the output file. I am supposed to pass the those two files as parameters.
How can I do this?
There are at least the following modules that could be coopted to produce the result:
Text::Diff
Algorithm::Diff
The latter is about a decade old, so the former (updated last year) is a better bet. There are other algorithms out the on CPAN too - Algorithm::LCS might be interesting were it not also most of a decade old. Generally, with Perl, the secret is to find someone else who has already answered the question for you.
Of course, that may not sit so well with teachers at school or university.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How can use a Perl script to create the plain text file. Perl should generate (random 16 bit hex) input data.
If you are new to Perl take a look at http://learn.perl.org
Check out Open, hex, and sprintf.
open a file handle, then print to it.
In addition to the other advice, to generate a random value, use Perl's rand function.
The Perl documentation can also be queried at your command prompt. For example, to access the FAQ:
perldoc -q random