Re: String in Array

2014-02-20 Thread Peter Gordon
5.14.0; my @alarm = (xyz, abc); my $name = ab; unless (grep {/\b$name\b/} @alarm) { print Not in array!\n } -- Peter Gordon, pete...@netspace.net.au on 02/21/2014 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

Re: String in Array

2014-02-20 Thread Peter Gordon
, abc); my $name = ab; my $name1 = abc; # Check ab. unless ( grep { /$name/ } @alarm ) { say $name not found; } else { say $name found; } # Check abc. unless ( grep { /$name1/ } @alarm ) { say $name1 not found; } else { say $name1 found; } [OUTPUT] ab found abc found -- Peter Gordon, pete

Re: Help with a RE

2014-01-09 Thread Peter Gordon
On Thu, 9 Jan 2014 09:55:45 +, Gary Stainburn wrote: On Thursday 09 January 2014 09:53:35 Gary Stainburn wrote: Oops, Missed a bit, try s/^[0-9]+[a-c]{0,1}[-_]//; Ringways Garages http://www.ringways.co.uk Yes, this works is probably more efficient than my RE. Thanks -- Peter Gordon

Help with a RE

2014-01-08 Thread Peter Gordon
])*(?:[-_])?(.*)/$1/; } say $oldname\t\t$newname; } -- Peter Gordon, pete...@netspace.net.au on 01/09/2014 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Help with a RE

2014-01-08 Thread Peter Gordon
On Thu, 9 Jan 2014 10:57:00 GMT, Peter Gordon wrote: I'm trying do write a one line RE to strip sequence numbers off filenames.  The filename can may have: No sequence numbers or Start with a variable number of digits, Followed by an optional character between a and c Followed by a compulsory

Re: Regrex Question

2013-11-25 Thread Peter Gordon
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- My attempt: #! /usr/bin/perl -w use 5.14.0; use strict; while( ) { if ( /(?:.*?)(\w+ \d+, \d+) at .*p$/ ) { print $1\n; } } -- Peter Gordon, pete...@netspace.net.au on 11/26/2013 -- To unsubscribe, e-mail: beginners-unsubscr

Re: Can't find perldoc in Cygwin

2013-11-17 Thread Peter Gordon
On 11/18/2013 10:45 AM, Juan Wei wrote: I have the Cywin version of perl installed on a Windows 7 computer, and it does not have a perldoc executable. How can I get perldoc functionality? Open a bash window type perldoc -h This should give you the documentation on perldoc. -- Peter Gordon

Re: Can't find perldoc in Cygwin

2013-11-17 Thread Peter Gordon
On Mon, 18 Nov 2013 00:35:17 -0500, Peter Holsberg wrote: Peter Gordon pete...@netspace.net.au wrote: On 11/18/2013 10:45 AM, Juan Wei wrote: I have the Cywin version of perl installed on a Windows 7 computer, and it does not have a perldoc executable. How can I get perldoc functionality? Open

Re: Always use strict

2013-08-05 Thread Peter Gordon
5.12.0; automatically turns on use strict; ? -- Peter Gordon, pete...@netspace.net.au on 08/06/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Always use strict

2013-08-05 Thread Peter Gordon
name at ./t line 4. # Execution of ./t aborted due to compilation errors. -- Peter Gordon, pete...@netspace.net.au on 08/06/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Always use strict

2013-08-05 Thread Peter Gordon
to compilation errors. #!/usr/bin/perl use 5.12.0; $var = Avalue; # Output # Global symbol $var requires explicit package name at ./t line 4. # Execution of ./t aborted due to compilation errors. -- Peter Gordon, pete...@netspace.net.au on 08/06/2013 -- To unsubscribe, e-mail: beginners-unsubscr

Re: using join

2013-08-04 Thread Peter Gordon
it there so you can use the same concept if you are going to save the string. my $str = join (map [$_], @fruits); say $str; This code outputs a blank line I can't see how to produce a string of the required output using join map. Anybody have an answer? Thanks -- Peter Gordon, pete

Re: using join

2013-08-04 Thread Peter Gordon
realised that the '' after join are two single quotes and not one double quote. -- Peter Gordon, pete...@netspace.net.au on 08/04/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: module installation dir, site_perl, and perl -V:sitelib

2013-07-26 Thread Peter Gordon
http://preview.tinyurl.com/c2h35h6 (You can control the directories which are in @INC) -- Peter Gordon, pete...@netspace.net.au on 07/26/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Handling special characters in peoples names in XML

2013-06-25 Thread Peter Gordon
have a file with mixed encodings, you have my sympathies. -- Peter Gordon, pete...@netspace.net.au on 06/26/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: perl hash loop: keys() vs values()

2013-06-15 Thread Peter Gordon
http://www.tizag.com/perlT/perlhashes.php particularly the section on sort by keys by values. This should give you a good understanding of the how to use them. -- Peter Gordon, pete...@netspace.net.au on 06/16/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

Re: begining

2013-05-19 Thread Peter Gordon
On Sun, 19 May 2013 09:16:33 -0700, John SJ Anderson wrote: Our FAQ has a list of recommended resources: http://www.perl.org/learn/faq/beginners.html#books Heck, that list is dated. Learning Perl is now in it's 6 th edition. -- Peter Gordon, pete...@netspace.net.au on 05/20/2013

Re: map problems

2013-05-16 Thread Peter Gordon
-- Peter Gordon, pete...@netspace.net.au on 05/17/2013 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/