"$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/
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
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/
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
@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/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>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";
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.
>>>
>&
>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
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
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/
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/
$_]", @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/
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
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/
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/
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
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
,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/
18 matches
Mail list logo