Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

question about ordering technical data numbers

by Kevin_Raymer (Initiate)
on Mar 09, 2007 at 17:05 UTC ( [id://604011]=perlquestion: print w/replies, xml ) Need Help??

Kevin_Raymer has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: question about ordering technical data numbers
by ysth (Canon) on Mar 09, 2007 at 19:44 UTC
    Dear Mr. Raymer,

    This was a pretty big problem for me, but I got it after trying lots. I'm good at technical things like this because I have 19 years of experience doing object oriended programming. PERL is hard, but you can make it do what you want if you just keep trying. I wanted other people to be able to use my program, so I couldn't use my varibels, and its hard to get it to do that.

    use strict; use warnings; ${\our %kev}{$ARGV[$_]}++ and splice @ARGV, $_, 1 for reverse 0..$#ARG +V; !defined( $_ = <> ) ? do { scalar( delete( ${\our %kev}{$$_[0]} ) && o +pen(KEV, ">", $_->[0]) xor print KEV $$_[2] ) for do { use vars '@kev +'; @kev }; exit }: ( push( @{\our @kev}, [$ARGV, (split(" ", $_))[-1] +, $_] ), our @kev = sort { $a->[0] cmp $b->[0] or $b->[1] <=> $a->[1] + } @kev ) while 1;
Re: question about ordering technical data numbers
by ptum (Priest) on Mar 09, 2007 at 19:52 UTC

    Silly Kevin. Please stop being a troll, or at least try to be a clever and funny troll.

    Because I read some of your other posts, I was pre-disposed to think you are a troll. (My definition: A troll is someone who attempts to provoke discussion and dispute for his own amusement without investing in the community which he trolls.) So I ran you through my troll-o-meter, with the following results:

    question about ordering technical data numbers

    +3 troll points.

    Rationale: Your title doesn't begin title with a capital letter, just the sort of carelessness a troll will demonstrate. The title contains three unnecessary words (question, technical, and data). We know it is a question, the word 'technical' is meaningless in this context, and either data or numbers are redundant, depending on what kind of data elements you are sorting.

    Okay I am going to be really technical here don't mean to throw off anyone and I am not trying to brag...

    Two more troll points.

    Rationale: You're posting on a website about Perl (by definition, rather technical) yet you're supposedly worried about 'throwing people off' or being 'really technical'.

    I am trying to do ordering of numbers that are in the end of a list of data

    Another troll point.

    Rationale: many real programmers would talk about 'ordering data' rather than 'do ordering', but the real issue is that this sentence doesn't really make any sense. You want to order numbers that are at the end of a list of data -- what about the data at the beginning and middle of the list? When you use the word 'list', many Perl developers will think 'array', but this sentence doesn't really make sense in that context, at least for me. Trolls often fail to make sense, and they often forget periods at the end of their sentences.

    So I am trying to use PERL SORT:

    Another troll point.

    Rationale: while lots of people use PERL as an acronym, most people don't keep doing it, especially after being gently corrected, as you were. When people keep doing things that they know annoy others, this is sometimes because they desire attention or are amused by stirring up annoyance in others, both classic troll behaviors.

    The next section didn't earn you any troll points, because you actually used code tags, possibly based on prior advice. Of course, the snippet you posted has nothing to do with Perl, but maybe you'll still get to something Perl-related. Trolls don't usually learn, so maybe you're not a troll?

    This seems to be the syntax which is easy for me to figure out cause I am an old hacker! What I don't get is the perl part of it

    Sigh. Another two troll points.

    Rationale: trolls like to brag, yet here you are supposedly asking for help. Real people who ask for real help that way don't get help; therefore you are likely a troll. I don't think most serious folks use the word 'hacker' quite like you do. Also, we see now you use 'perl' (often used to refer to the perl interpreter) when you probably mean 'Perl'.

    Summarizing the rest of your post, you get another two troll points for the phrase 'computer generated errors', and for your comment about "compiling". Also, you use the word 'technical' again.

    Total score: 11 troll points.

    In the unlikely case that you are a serious, real person, please stop these troll-like behaviors (or try to be more funny). If you are a troll, please go away.

      Now, you see here . . . our troll meter goes to eleven. That's one more, isn't it? You see most trolls, you know, will be trolling at ten. You're on ten here, all the way up. All the way up. Where can you go from there? Where?

        I don't know...
Re: question about ordering technical data numbers
by Joost (Canon) on Mar 09, 2007 at 17:10 UTC
Re: question about ordering technical data numbers
by Sixtease (Friar) on Mar 09, 2007 at 18:39 UTC

    Hi Kevin,

    I don't understand exactly what you're trying to sort but if you wish to sort the lines in a file, then this command would do the job:

    perl -e 'print sort <>' file_to_sort.txt

    You'll get the sorted lines on stdout, you may wish to redirect it to a file.

    By the way, notice that perl is case-sensitive, which is why OPEN and SORT are giving you errors. The functions are open and sort, lowercase.

Re: question about ordering technical data numbers
by blue_cowdawg (Monsignor) on Mar 09, 2007 at 22:23 UTC

    When sorting pearls you have to remember to not only sort them by size, but you also have to sort them by color and quality.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: question about ordering technical data numbers
by Ojosh!ro (Beadle) on Mar 12, 2007 at 15:56 UTC

    Hehehe, the only thing I understand is the perl part.But that dramatically ends after use strict;
    It makes the ,,old hacker'' remark all the funnier.
    Thanks for the giggle, I'm back to meditating now.

    if( exists $aeons{strange} ){ die $death unless ( $death%2 ) }
Re: question about ordering technical data numbers
by xorl (Deacon) on Mar 16, 2007 at 17:21 UTC

    see sort

    You've got to learn that Perl is not DOS. You've been a "hacker" for how long and have now many degrees and you still haven't figured this out?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://604011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-10-14 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.