Help for this page

Select Code to Download


  1. or download this
      my @dates = qw( 2001-12-24 1999-03-2 2004-04-23 );
      print join(', ', sort { $b cmp $a } @dates );
    
  2. or download this
      2004-04-23, 2001-12-24, 1999-03-2
    
  3. or download this
    sort { $a->{date} cmp $b->{date} } @$array
    
  4. or download this
    grep { $_->{date} ge $today } ...
    
  5. or download this
     ( ... )[0]->{isnext} = 1;
    
  6. or download this
    (grep {$_->{date} ge $today} sort {$a->{date}cmp $b->{date} } @$array)
    +[0]->{isnext} = 1;
    
  7. or download this
    my $today = '2001-03-28';
    my $array = [
    ...
    # alternatively : 
    my $thenext = (grep { $_->{date} ge $today } sort { $a->{date} cmp $b-
    +>{date} }  @$array)[0];
    print "\nThe next date is: $thenext->{date}\n";