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 a perl script which sends a mail to the developer to show the status i.e. fail or pass to developer email id. I also want to get the such status mail when I am using the script. So,I tried as below ,
TO: 'developer#abc.com , $userid#abc.com'. But in this case developer is getting the mnailbut I am still not getting it. can you Please help here?
I am new to Perl and so it may be possible that my question is not upto the stanard.But please help,I need it urgently.
Thanks & regards,
Gautam
you are interpolating a variable into a single quoted string. Perl assumes everything in single quotes should be taken literally..
example:
my $userid = 'admin';
my $string = '$userid#abc.com';
print $string;
results in "$userid#abc.com"
However, if you substitute double quotes in the second line
my $string = "$userid\#abc.com";
results in "admin#abc.com"
So if you want to interpolate a variable use double quotes:
"developer\#abc.com , $userid\#abc.com"
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 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 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/