Re: String in Array

2014-02-20 Thread Peter Gordon
"$name found"; } # Check "abc". unless ( grep { /$name1/ } @alarm ) {     say "$name1 not found"; } else {     say "$name1 found"; } [OUTPUT] ab found abc found -- 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://learn.perl.org/

Re: String in Array

2014-02-20 Thread Peter Gordon
NOT 'do this'. >What >have I got wrong? > Use word boundaries #!/usr/bin/perl -w use 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

Re: Help with a RE

2014-01-09 Thread Peter Gordon
more efficient than my RE. Thanks -- 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

Help with a RE

2014-01-08 Thread Peter Gordon
@ar ) { my $oldname = my $newname = $_; if( $newname =~ s/^\d+(.*)/$1/ ) { $newname =~ s/(?:[a-c])*(?:[-_])?(.*)/$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: Regrex Question

2013-11-25 Thread Peter Gordon
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >Thunder Rain Internet Publishing >-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- My attempt: #! /usr/bin/perl -w use 5.14.0; use strict; while( <> ) { if ( /(?:.*?)(\w+ \d+, \d+) at .*$/ ) { print "$1\n";

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  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. >>> >&

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 documentatio

Re: Always use strict

2013-08-05 Thread Peter Gordon
A_Value"; # No error produced. #!/usr/bin/perl use strict; $var = "A_Value" # Output # Global symbol "$var" requires explicit package name at ./t line 4. # Execution of ./t aborted due to compilation errors. #!/usr/bin/perl use 5.12.0; $var = "Avalue"; # Outpu

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...@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
tions/use.html Does it mean that: use 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: using join

2013-08-04 Thread Peter Gordon
$_]", @fruits; to the clipboard & entered it in a text editor, that I 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: using join

2013-08-04 Thread Peter Gordon
eed the join if you are just printing it but i put >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 u

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

2013-07-26 Thread Peter Gordon
lib? > On the off chance that you don't know about PERL5LIB, check 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
ther find out the encoding &/or change it to utf8. If you 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
someone explain this please? > > Read 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: beginne

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
,cn=xxx,dc=domain,dc=tld cn=group2,cn=xxx,d=domain group1 -- 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/