Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thank you!!#!/usr/bin/perl use strict; use warnings; my $data = [ { 'date' => '20160101', 'day' => 'Friday' }, { 'date' => '20160215', 'day' => 'Monday' }, { 'date' => '20160530', 'day' => 'Monday' }, { 'date' => '20160704', 'day' => 'MOnday' }, { 'date' => '20160905', 'day' => 'Monday' }, { 'date' => '20161010', 'day' => 'Monday' }, { 'date' => '20161124', 'day' => 'Thursday' }, { 'date' => '20161125', 'day' => 'Friday' }, { 'date' => '20161226', 'day' => 'Monday' }, { 'date' => '20170102', 'day' => 'Monday' } ]; my $search = "20161010"; my $result = ( grep( /^$search$/, @{ $data } ) ) ? 'Found' : 'Not Foun +d'; print $result."\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching with grep
by choroba (Cardinal) on Mar 23, 2016 at 18:09 UTC | |
by Anonymous Monk on Mar 23, 2016 at 18:20 UTC | |
by Anonymous Monk on Mar 23, 2016 at 18:24 UTC | |
|
Re: Searching with grep
by Marshall (Canon) on Mar 24, 2016 at 01:09 UTC |