Rob Dixon wrote:
On 29/11/2010 23:46, John W. Krahn wrote:
As Rob said [2..254] is a character class that matches one character (so
"127.0.0.230" should match also.) You also don't anchor the pattern so
something like '765127.0.0.273646' would match as well. What you need is
something like thi
> "GK" == Guruprasad Kulkarni writes:
GK> Here is another way to do it:
GK> /^127\.0\.0\.([\d]|[1-9][\d]|[1][\d][\d]|[2]([0-4][\d]|[5][0-4]))$/) {
why are you putting single chars inside a char class? [\d] is the same
as \d and [1] is just 1.
also please don't quote entire emails below
>-Original Message-
>From: John W. Krahn [mailto:jwkr...@shaw.ca]
>Sent: Tuesday, November 30, 2010 12:47 AM
>To: Perl Beginners
>Subject: Re: regexp matching nummeric ranges
>As Rob said [2..254] is a character class that matches one character
(so
>"127.0.0.230" should match also.) Yo
Hi Marco,
Here is another way to do it:
#!/usr/bin/perl
use strict;
use warnings;
my $ip = "127.0.0.1";
if ($ip =~
/^127\.0\.0\.([\d]|[1-9][\d]|[1][\d][\d]|[2]([0-4][\d]|[5][0-4]))$/) {
print "IP Matched!\n";;
} else {
print "No Match!\n";
}
On Tue, Nov 30, 2010 at 11:21 AM, Rob Dixon wrote:
On 29/11/2010 23:46, John W. Krahn wrote:
Kammen van, Marco, Springer SBM NL wrote:
Dear List,
Hello,
I've been struggeling with the following:
#!/usr/bin/perl
use strict;
use warnings;
my $ip = ("127.0.0.255");
if ($ip =~ /127\.0\.0\.[2..254]/) {
print "IP Matched!\n";;
} else {
print "
Is there a way to use variables in a translation? I'm looking for a way
to use, for example, $x = "abc" and $y = "ABC" so something like
y/$x/$y/;
behave like
y/[abc]/[ABC]/;
The tr/// operator doesn't interpolate so you have to do something like:
eval y/$x/$y/;
I tried using that, but $t
> "JWK" == John W Krahn writes:
JWK> John W. Krahn wrote:
>> John wrote:
>>> Is there a way to use variables in a translation? I'm looking for a way
>>> to use, for example, $x = "abc" and $y = "ABC" so something like
>>
>> eval y/$x/$y/;
JWK> Oops!
you forgot to oops that li
John W. Krahn wrote:
John wrote:
Is there a way to use variables in a translation? I'm looking for a way
to use, for example, $x = "abc" and $y = "ABC" so something like
y/$x/$y/;
behave like
y/[abc]/[ABC]/;
The tr/// operator doesn't interpolate so you have to do something like:
eval y/$x
John wrote:
Is there a way to use variables in a translation? I'm looking for a way
to use, for example, $x = "abc" and $y = "ABC" so something like
y/$x/$y/;
behave like
y/[abc]/[ABC]/;
The tr/// operator doesn't interpolate so you have to do something like:
eval y/$x/$y/;
Or perhaps:
m
Is there a way to use variables in a translation? I'm looking for a way
to use, for example, $x = "abc" and $y = "ABC" so something like
y/$x/$y/;
behave like
y/[abc]/[ABC]/;
Thanks,
John
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-
On Nov 29, 4:33 am, bourne.ident...@hotmail.com (Manish Jain) wrote:
> [...]
> print(hndw, $nextline); #problem here
>
> }
>
> But perl refuses to take a comma between hndw and $nextline, and consequently
> I have to rewrite it as : print hndw $nextline;
>
That's because 'pri
Kammen van, Marco, Springer SBM NL wrote:
Dear List,
Hello,
I've been struggeling with the following:
#!/usr/bin/perl
use strict;
use warnings;
my $ip = ("127.0.0.255");
if ($ip =~ /127\.0\.0\.[2..254]/) {
print "IP Matched!\n";;
} else {
print "No Match!\n";
}
For a reason i don't
Hi;
>> The reason one should use File::Basename and File::Spec is that you
>> can become platform-independent instead of Windoze-worshipping :-)
>
> What does the operating system have to do with this?
>
> OP asked how to split a string, I gave an example how to do it character by
> character.
On 2010-11-29 02:27, Kenneth Wolcott wrote:
On Sun, Nov 28, 2010 at 12:31, Dr.Ruud wrote:
On 2010-11-28 10:54, Chaitanya Yanamadala wrote:
How do i split a value like this
F:\test\test123\test1233
For example:
ruud$ perl -wle 'print for split //, q{F:\test\test123\test1233}'
F
:
-snip-
3
Look
http://napublicidade.com/pinrx.html
Your personal Discount Coupon: discount888
William
esia...@yahoo.com
>
> For a Windows shop, the overhead of platform independence is redundant,
>
Premature optimization much?
Brian.
On 29/11/2010 14:22, Kammen van, Marco, Springer SBM NL wrote:
Dear List,
I've been struggeling with the following:
#!/usr/bin/perl
use strict;
use warnings;
my $ip = ("127.0.0.255");
if ($ip =~ /127\.0\.0\.[2..254]/) {
print "IP Matched!\n";;
} else {
print "No Match!\n";
}
For a rea
But it accept!
--
print "Hello", " ", "World!", "\n";
--
In your case you are just using the wrong syntax for optional file handle..
> De: Manish Jain
> Assunto: Why can't print accept a comma between arguments ?
> Para: beginners@perl.org
> Data: Segunda-feira, 29 de Novembro de 2010, 10:33
Dear List,
I've been struggeling with the following:
#!/usr/bin/perl
use strict;
use warnings;
my $ip = ("127.0.0.255");
if ($ip =~ /127\.0\.0\.[2..254]/) {
print "IP Matched!\n";;
} else {
print "No Match!\n";
}
For a reason i don't understand:
127.0.0.1 doesn't match as expected...
Eve
Manish Jain wrote:
Hi all,
Hello,
I want to do this :
open(hndr, "/home/manjain/.bash_profile");
open(hndw, ">", "/home/manjain/bashrc.copy");
You should *always* verify that the files opened correctly before trying
to use the filehandles. Something like:
open hndr, '<', '/home/manjai
Hi all,
I want to do this :
open(hndr, "/home/manjain/.bash_profile");
open(hndw, ">", "/home/manjain/bashrc.copy");
while ($nextline = )
{
$nextline =~ s/manjain/\$USER/g;
print(hndw, $nextline); #problem here
}
But perl refuses to take a comma between hndw and $next
> "ES" == Erez Schatz writes:
ES> On 11/29/2010 03:27 AM, Kenneth Wolcott wrote:
>>
>> The reason one should use File::Basename and File::Spec is that you
>> can become platform-independent instead of Windoze-worshipping :-)
>>
>> Ken Wolcott
>>
ES> I worship whatever I'm
On 11/29/2010 03:27 AM, Kenneth Wolcott wrote:
>
> The reason one should use File::Basename and File::Spec is that you
> can become platform-independent instead of Windoze-worshipping :-)
>
> Ken Wolcott
>
I worship whatever I'm paid to work on. For a Windows shop, the overhead
of platform in
23 matches
Mail list logo