On 18 Oct 2007, at 12:55 PM, [EMAIL PROTECTED] wrote:
-snip-
Even the @weekdays doen't yield all the days instead it yields the
combination of three days...
my @weekdays = join '|', qw;
my @months = join '|', qw;
print @weekdays;
-snip-
Er, because is not a valid range in Perl. Example
Hi,
Comment me if there is any mistake of mine please?
Even the @weekdays doen't yield all the days instead it
yields the combination of three days...
Thanks yar
Boniface
-
#!/usr/bin/perl
open DAT,")
{
#print $line,"\n";
my @weekdays = join '|', qw;
my @mo
1: sub newopen {
2: my $path = shift;
3: local *FH; # not my!
4: open (FH, $path) or return undef;
5: return *FH;
6: }
7: $fh = newopen('/etc/passwd');
I believe the idea was that a FH may already exist in
On 10/18/07, lists user <[EMAIL PROTECTED]> wrote:
>
> why it say a 'local *FH' here?
> why not just,
>
> open FH,$path or return undef;
> return *FH;
Because local would protect the global file-handle FH which maybe was
already opened out of the subroutine.
See this test,
use strict;
I saw this code piece in perldoc perldata,
sub newopen {
my $path = shift;
local *FH; # not my!
open (FH, $path) or return undef;
return *FH;
}
$fh = newopen('/etc/passwd');
why it say a 'l
FreeBSD, and that's actually what I ended up doing basically using
cat and grep -v.
Thanks,
On Oct 17, 2007, at 9:14 PM, yitzle wrote:
If you are on a Linux machine, it might just be easier to use the grep
command with a shell script.
FILE_NAME="./log"
TMP_FILE="./tmp"
IP_TO_REMOVE="192.16
If you are on a Linux machine, it might just be easier to use the grep
command with a shell script.
FILE_NAME="./log"
TMP_FILE="./tmp"
IP_TO_REMOVE="192.168.0.0|192.168.0.255"
COUNT=`grep $IP_TO_REMOVE $FILE_NAME | wc -l`
echo "The IPs occur $COUNT times"
grep -v $IP_TO_REMOVE $FILE_NAME > $TMP_
On 10/18/07, Phillip Gonzalez <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to search a .txt file for matching ip addresses. I then want to
> delete those ip >addresses.
>
The better way for finding an IP from given list is to use Net::IP
module from CPAN rather than using regex I think.
--
T
They have all been helpful.
Thanks,
On Oct 17, 2007, at 4:40 PM, Matthew Whipple wrote:
Matthew Whipple wrote:
yitzle wrote:
Take a look at the grep function
http://perldoc.perl.org/functions/grep.html
Also of potential use is the qr// quote operator:
http://perldoc.perl.org/perlop.html#
Matthew Whipple wrote:
> yitzle wrote:
>
>> Take a look at the grep function
>> http://perldoc.perl.org/functions/grep.html
>>
>> Also of potential use is the qr// quote operator:
>> http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators
>>
>> This lets you do:
>>
>> my $ip_search = qr/
yitzle wrote:
> Take a look at the grep function
> http://perldoc.perl.org/functions/grep.html
>
> Also of potential use is the qr// quote operator:
> http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators
>
> This lets you do:
>
> my $ip_search = qr/$ip_string/;
> my @lines_with_ip = grep
Take a look at the grep function
http://perldoc.perl.org/functions/grep.html
Also of potential use is the qr// quote operator:
http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators
This lets you do:
my $ip_search = qr/$ip_string/;
my @lines_with_ip = grep /$ip_search/, @raw_data; # or
Hi All,
I am using Treepp module for XML parsing.
If I have a file as follows :
ABCD
EFGH
abcd abcd
abcd
I want to access each section
Ex - tree->{Family}->{Father}
tree->{Family}->{Mother}
On 10/17/07, Panda-X <[EMAIL PROTECTED]> wrote:
> I have tried to use utf8, and I can print the file name in right "string",
> but when I try to open the file and read. It happens "No such file or
> directory".
Sometimes, two different strings can seem identical on-screen. Can you
use readdir or
Hi,
I'm trying to search a .txt file for matching ip addresses. I then want to
delete those ip addresses.
So far I have opened the file where the ip list is and stored it in an array.
But How do I search the array for ip's?
Here's what I have so far:
#!/usr/bin/perl
$data_file="/home/uid/
Hi all,
I am writing a (executable) program with Tk, which will let user to submit
file ( by drag drop ) from their machine to our server. But in most case,
user will drop their file from desktop in Windows, however, the windows is
in Chinese version. So, desktop is "桌面".
I have tried to use utf8
On 10/17/07, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: "Chas. Owens" <[EMAIL PROTECTED]>
> > which can be implemented like this
> >
> > my @weekdays = join '|', qw;
> > my @months = join '|', qw;
> >
> > /Start date (?:@weekdays), ((?:@months) \d{2} \d{4})/;
>
> I think you mean $weekdays a
From: "Chas. Owens" <[EMAIL PROTECTED]>
> which can be implemented like this
>
> my @weekdays = join '|', qw;
> my @months = join '|', qw;
>
> /Start date (?:@weekdays), ((?:@months) \d{2} \d{4})/;
I think you mean $weekdays and $months :-)
It works with the @ as well, but it's misleading. There
On 10/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> 1 per 1 guest
>
>
> Start date Monday, March 12 2007
>
> End date Tuesday, March 13 2007
>
>
> My html page looks like as given above. And my RE to
> capture the dates are given below. Kindly suggest me the
On 10/16/07, Kevin Viel <[EMAIL PROTECTED]> wrote:
snip
> > If the first field can be just a dot too, consider this:
> >
> > s/ (\A|,) [.] (?=,|\z) /$1/xg
> ^ ^ ^^
> > (if you chomp first :)
>
> Thank you kindly for your response. Are the spaces, which I highlighted
> with c
1 per 1 guest
Start date Monday, March 12 2007
End date Tuesday, March 13 2007
My html page looks like as given above. And my RE to
capture the dates are given below. Kindly suggest me the
beat way to do that?
On 10/17/07, Subhash Chandran <[EMAIL PROTECTED]> wrote:
> I was able to make mod_perl and now the server is mod_perl enabled. But as
> per the README in Apache::DBI if the httpd.conf is set as below
> PerlModule Apache::DBI
>the server doesnt start. I get the following in the
Hi
Can anyone help me to configure Apache::DBI to the Apache2 server.
System config:
OS Windows XP
Perl 5.8.8
Apache 2.2.4
mod_perl: 2.0.3
Apache::DBI 1.06
I was able to make mod_perl and now the server is mod_perl enabled. But as
per the README in Apache::DBI if the httpd.conf is set as bel
> -Original Message-
> From: Dr.Ruud [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 16, 2007 3:57 PM
> To: beginners@perl.org
> Subject: Re: Overlapping substitution
>
>
> If the first field can be just a dot too, consider this:
>
> s/ (\A|,) [.] (?=,|\z) /$1/xg
^ ^ ^
Dear my friend, David.
Since you told me that you meet the same problem (and I also use opensuse, mine
is 10.2): Here what I've done as I solved the problem, thread below:
http://www.perlmonks.org/?node_id=517871
as root I do so:
1. cd /PATH/TO/.cpan/build/Net-Google-1.0
2. cp -pR lib/Net/Google/
> Use of uninitialized value in concatenation (.) or string at
> /usr/lib/perl5/site_perl/5.8.8/Net/Google/Service.pm line 80.
> Service description 'file:' can't be loaded: 404 File `' does not exist
Hmmm. FWIW, I tried to reproduce your problem, but I needed to
install Net::Google on my machin
26 matches
Mail list logo