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.
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.
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 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.
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
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 have shell scripting knowledge.
I have written a small shell script which will take a single argument.
with the help of that argument.
the file name format is axeA10_<date_time_stamp>_<sequence_number>.DAT
my script just takes all the files in the current directory and changes the sequence number.
so that i have the files with sequence numbers.
the need to write this script is that i dont have the files with the sequence number as some of the sequences are missing.
I know that perl can be more fast in doing this kind of tasks.And so i want to learn the same.
Can anyone convert this small shell script to perl.this would really boost my confidence in learning perl.Thanks in advance.Below is the script which works fine.
#!/bin/ksh
counter=1
for i in ${1}*.DAT
do
if [ $counter -lt 10 ]
then
new_name=`echo "$i"|awk -vcount=$counter 'BEGIN{FS="_";OFS="_"}{$3=count}{print $1"_"$2"_0"$3".DAT"}'`
else
new_name=`echo "$i"|awk -vcount=$counter 'BEGIN{FS="_";OFS="_"}{$3=count}{print $0".DAT"}'`
fi
mv $i $new_name
counter=$(($counter+1))
done
exit
"Can anyone convert this small shell script to perl.this would really boost my confidence in learning perl."
How would someone doing this for you boost your confidence?
Visit the following URL
http://learn.perl.org/