Re: RE

2007-10-17 Thread Dyana Wu
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

Re: RE

2007-10-17 Thread neelike
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

Re: local *FH

2007-10-17 Thread yitzle
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

Re: local *FH

2007-10-17 Thread Jeff Pang
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;

local *FH

2007-10-17 Thread lists user
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

Re: Search for IP address and delete from file

2007-10-17 Thread Phillip Gonzalez
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

Re: Search for IP address and delete from file

2007-10-17 Thread yitzle
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_

Re: Search for IP address and delete from file

2007-10-17 Thread Jeff Pang
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

Re: Search for IP address and delete from file

2007-10-17 Thread Phillip Gonzalez
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#

Re: Search for IP address and delete from file

2007-10-17 Thread Matthew Whipple
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/

Re: Search for IP address and delete from file

2007-10-17 Thread Matthew Whipple
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

Re: Search for IP address and delete from file

2007-10-17 Thread yitzle
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

Using XML Treepp

2007-10-17 Thread vikram vikram vikram
  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}

Re: Any clues to access Chinese folder name on Win32 ?

2007-10-17 Thread Tom Phoenix
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

Search for IP address and delete from file

2007-10-17 Thread Phillip Gonzalez
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/

Any clues to access Chinese folder name on Win32 ?

2007-10-17 Thread Panda-X
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

Re: RE

2007-10-17 Thread Chas. Owens
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

Re: RE

2007-10-17 Thread Jenda Krynicky
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

Re: RE

2007-10-17 Thread Chas. Owens
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

Re: Overlapping substitution

2007-10-17 Thread Chas. Owens
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

RE

2007-10-17 Thread neelike
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?

Re: Configuring Apache::DBI in Apache2

2007-10-17 Thread Jeff Pang
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

Configuring Apache::DBI in Apache2

2007-10-17 Thread Subhash Chandran
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

RE: Overlapping substitution

2007-10-17 Thread Kevin Viel
> -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 ^ ^ ^

Re: WWW::Search::Google-->Service description 'file:' can't be loaded: 404 File `' does not exist

2007-10-17 Thread Patrik Hasibuan
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/

Re: WWW::Search::Google-->Service description 'file:' can't be loaded: 404 File `' does not exist

2007-10-17 Thread davidfilmer
> 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