Re: String in Array

2014-02-20 Thread Peter Gordon
On Thu, 20 Feb 2014 15:05:42 -0600, Matt wrote: >my @alarm = ("xyz", "abc"); >>my $name = "ab"; >>unless (grep {/$name/} @alarm) { # do this } >If I set 'my $name = "abc";' it seems to match.  But I want to match >on "ab" as well.   It appears to do this already.   #!/usr/bin/perl -w use 5.14.0;

Re: String in Array

2014-02-20 Thread Matt
> Having trouble making this work. > > my @alarm = ("xyz", "abc"); > my $name = "ab"; > unless (grep {/$name/} @alarm) { # do this } > > Since "ab" is contained in the array I want it to NOT 'do this'. What > have I got wrong? If I set 'my $name = "abc";' it seems to match. But I want to match

Re: Passing multiple select statements to MySQL

2014-02-20 Thread SSC_perl
On Feb 19, 2014, at 4:20 AM, Dr.Ruud wrote: > my $sth_4; > ... > (untested) Thanks for the code but I still get the same error: DBD::mysql::st execute failed: You have an error in your SQL syntax; - Long pause for trial and error -- Well with the help of the auth

Re: String in Array

2014-02-20 Thread Uri Guttman
On 02/20/2014 02:04 PM, Matt wrote: Having trouble making this work. my @alarm = ("xyz", "abc"); my $name = "ab"; unless (grep {/$name/} @alarm) { # do this } Since "ab" is contained in the array I want it to NOT 'do this'. What have I got wrong? can you show this not working? it looks good

Re: String in Array

2014-02-20 Thread Peter Gordon
On Thu, 20 Feb 2014 13:04:56 -0600, Matt wrote: >Having trouble making this work. > >my @alarm = ("xyz", "abc"); >my $name = "ab"; >unless (grep {/$name/} @alarm) { # do this } > >Since "ab" is contained in the array I want it to NOT 'do this'. >What >have I got wrong? > Use word boundaries #!/us

String in Array

2014-02-20 Thread Matt
Having trouble making this work. my @alarm = ("xyz", "abc"); my $name = "ab"; unless (grep {/$name/} @alarm) { # do this } Since "ab" is contained in the array I want it to NOT 'do this'. What have I got wrong? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands,

Re: time based test

2014-02-20 Thread shawn wilson
Thanks Also, for completeness, in that doc is also stated Time::Warp and someone also pointed me to Time::Mock and Test::TimeMock. The later seems to have the best interface for my needs, so I'll go with that. On Sat, Feb 15, 2014 at 6:05 AM, David Precious wrote: > On Fri, 14 Feb 2014 16:21:52