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.
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 want to import all data from ascii file exclude the first row that is a description. I can import all data correctly if that line missing. I've used imporData.
Edit:
I've resolved it just moving the file pointer ahead by one.
This is the code
FH = fopen(f_old,'rb');
firstRowString = fgetl(FH);
use
A = importdata(filename,delimiterIn,headerlinesIn)
This can load data from an ASCII file reading numeric data starting from line headerlinesIn+1 where delimiterIn is the column separator character, specified as a string. The default character is interpreted from the file. Use '\t' for tab.
http://www.mathworks.co.uk/help/matlab/ref/importdata.html#inputarg_headerlinesIn
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 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 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