Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: map grep and sort

by moritz (Cardinal)
on May 25, 2013 at 08:08 UTC ( #1035244=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    my @a = map { transformation($_) } @b;
    # same as
    my @a;
    push @a, tranformation($_) for @b;
  2. or download this
    my @a = grep { condition($_) } @b;
    # same as
       push @b, $_ if condition($_);
  3. or download this
    my @even = grep $_ % 2 == 0, @numbers;
    my @odd  = map $_ * 2 +1,    @numbers;
  4. or download this
    my @numbers = grep /^[0-9]+$/, @words;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1035244]
[choroba]: You definitely can, but the How is complex. It probably depends on the WM (but you can probably tweak the underlying X layer to provide it)
[choroba]: Google says that on Ubuntu, you can just use Ctrl+Shift instead of Alt
[choroba]: that is, ctrl+shift+U followed by the hex code of the character

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-12-13 11:14 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (358 votes). Check out past polls.