10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
@sorted = sort { $a <=> $b } @unsorted;
I am having hard time understanding how this works? I know the output but interested to know the working.
Thanks in advance. (2 Replies)
Discussion started by: Tanu
2 Replies
2. Shell Programming and Scripting
I am using this line of perl code to change the file format and remove ^M at the end of each line in files:
perl -i -pe's/\r$//;' <name of file here>
Can you explain to me what this code does, and translate it into bash/awk/sed? (2 Replies)
Discussion started by: locoroco
2 Replies
3. Shell Programming and Scripting
Hi all,
Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM.
Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers.
At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies
4. Shell Programming and Scripting
Hi,
i have a txtfile with the format <Nr>tab<word>tab<other stuff>new line and i want to sort the <word>-colum with a perl script.
My textfile:
<Nr>tab<word>tab<other stuff>new line
6807 die ART.Acc.Sg.Fem
6426 der ART.Gen.Sg.Fem
2 die ART.Nom.Sg.Fem
87 auf APPR.--
486 nicht PTKNEG.--... (1 Reply)
Discussion started by: buckelede
1 Replies
5. Shell Programming and Scripting
Can someone please explain what tr#A-Za-z0-9+/# -_#; means in perl? (4 Replies)
Discussion started by: 3junior
4 Replies
6. Shell Programming and Scripting
Hi All,
I have an array in perl as @match = (201001,201002,201001,201002);
I am trying to sort this array as
@match = sort(@match);
print "@match";
I dont see the output sorted any answers
I also tried another way, but still the results are not sorted
foreach my $match (sort { $a... (2 Replies)
Discussion started by: bsdeepu
2 Replies
7. Shell Programming and Scripting
How is it possible to sort different nummeric values within an Array. But i don`t want the highest or the lowest. I need the most frequently occurring value.
For examble:
My Array has to following values = (200 404 404 500 404 404 404 200 404)
The result should be 404
The values are... (3 Replies)
Discussion started by: 2retti
3 Replies
8. Shell Programming and Scripting
Hi Everyone,
I have:
my @No=qw(032106 032630 0380 034010 035110 0354801111);
my $str_No=join(';', @No);
I have a string $strA="03263033", so in order to determine this $strA area code matches with @No, I can do:
if ( (rindex($str_No,substr($strA,0,5))))== -1) ) {
print "Not... (1 Reply)
Discussion started by: jimmy_y
1 Replies
9. UNIX for Advanced & Expert Users
hi all
i was going through some perl code i came across this line and i am not getting what is exactly going on ..
$$this{localtion} = GetName->GetVarName("EXE_DIR") ;
what is the red part doing in above code (2 Replies)
Discussion started by: zedex
2 Replies
10. Shell Programming and Scripting
Hi,
When using sort on an associative array:
foreach $key (sort(keys(%opalfabet))){
$value = $opalfabet{$key};
$result .= $value;
}
How does it handle double values?
It seems to me that it removes them, is that true? If so, is there a way to get... (2 Replies)
Discussion started by: tine
2 Replies