Re: regex question

2007-05-14 Thread Igor Sutton Lopes
Hi, On May 14, 2007, at 11:50 PM, Tom Allison wrote: yitzle wrote: # Requires "by": $line = "daffromHello Worldby"; $line =~ /from(.*)(by)/; print $1; Not sure about making it optional. Can always check if you got "" and then try without the "by" the .* pulls in too much. I'm going to have

Re: Sorting dir output

2007-04-10 Thread Igor Sutton Lopes
Sorry! I was testing and sent the last version -TextMate integrated with Mail.app- :-( On Apr 10, 2007, at 4:40 PM, John W. Krahn wrote: [...] Did you test this? Where do you distinguish between files "older than 3 days" and other files? Where is "name('trunk')" specified by the OP? Th

Re: Sorting dir output

2007-04-10 Thread Igor Sutton Lopes
Hi, On Apr 10, 2007, at 3:27 PM, John W. Krahn wrote: Craig Schneider wrote: Hi Guys Hello, How could I exec a 'dir' command on a dos system and put the output in an array, sort by date and the files that are older than 3 days be moved into a folder called 'history' # open the curre

Re: Can I map this

2007-04-04 Thread Igor Sutton Lopes
On 2007/04/04, at 18:12, Randal L. Schwartz wrote: "Igor" == Igor Sutton Lopes <[EMAIL PROTECTED]> writes: Igor> my $str = join( " ", map { s/\B(\w+)/\L\1/; $_ } split( / \s+/, $_ ) ); It's bad style to modify $_ in a map, because that also m

Re: Can I map this

2007-04-04 Thread Igor Sutton Lopes
On 2007/04/04, at 16:28, Beginner wrote: while () { my @words = split(/\s+/,$_); my $str; foreach my $w (@words) { my $s = lc($w); $s = ucfirst($s); $str .= $s.' '; } print "STR=$str\n"; } __DATA__ SOME NAME SOMEONE WITH FOUR NAMES ONE WITH THREE A-HYPENED NAME

Re: Using case in Perl

2007-04-04 Thread Igor Sutton Lopes
On 2007/04/04, at 14:58, Jeff Pang wrote: How about this? if ($ARGV[0] eq 'start') { print "Starting PostgreSQL:\n"; unless (fork) { exec "su - $PGUSER -c \"$DAEMON -D \'$PGDATA\' "; }else { print "ok\n"; exit; } } elsif ($ARGV[0] eq 'stop') { ..

Re: use lib

2007-04-02 Thread Igor Sutton Lopes
Hi,, On 2007/04/02, at 20:32, Nigel Peck wrote: Hi, I've recently starting writing my own modules. At the top of each script that uses my modules I do: use lib qw( /home/nigel/mis_perl_modules/dev ); while I'm developing them and then change it to: use lib qw( /home/nigel/mis_perl_modul

Re: Not an ARRAY reference. Problems reading a simple XML file

2007-04-02 Thread Igor Sutton Lopes
On 2007/04/02, at 15:14, Dave Adams wrote: My script is having problems reading and XML file with only one record in it. When I add two or more records, there are no problems. The error is "Not and ARRAY reference.." Here is the PROBLEM xml file (test.xml): FBIS2004 CP1 Here is t

Re: Trying to make things portable

2007-04-02 Thread Igor Sutton Lopes
On 2007/04/02, at 11:04, Jeff Pang wrote: I am trying to group some common subroutines into a module. As I use both Win32 and *nix systems I wanted the the routines that use the file system to be able to work in both environments and handle paths like /var/path/to/dir and h:\home\dir equally

Re: Dealing with ar archives

2007-03-19 Thread Igor Sutton Lopes
On 2007/03/19, at 01:11, Ana Saiz García wrote: Exactly that ^_^ In addition, to use that simple module I must install 6 more or so, and this is too much for the single and simple operation I want to do. I still can't see the problem. If it uses a lot of other CPAN modules, that is a Good T

Re: Files Operations in Pearl

2007-03-16 Thread Igor Sutton Lopes
Hi Rodrigo, On 2007/03/16, at 18:09, Rodrigo Faria Tavares wrote: Hello, In shell-script I get a variable with command line: AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost" | awk '{print $3}' | head -n1` In C++, I use the functions read, write and others for manipulation files. And P

Re: Dealing with ar archives

2007-03-16 Thread Igor Sutton Lopes
On 2007/03/16, at 20:33, Ana Saiz García wrote: Thank you for your answer On 15/03/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 3/15/07, Ana Saiz García <[EMAIL PROTECTED]> wrote: > Hello everybody > > I have to make a little program that deals with the contents of some > ar archives. Do yo

Re: Matching the domain of a URL

2007-03-15 Thread Igor Sutton Lopes
On 2007/03/15, at 18:29, Jenda Krynicky wrote: From: Igor Sutton Lopes <[EMAIL PROTECTED]> my @possible_values = qw{ http://www.google.com https://my.domain. http://some.other.domain.net }; my @urls = qw{ http://www.google.com/?some_bizarre_args https://my.domain.com

Re: polling a directory

2007-03-14 Thread Igor Sutton Lopes
On 2007/03/14, at 17:55, Beginner wrote: Hi, I am trying to find a means of monitoring a directory for activity. I would like a perl process to aware if a file has been dropped into a specific folder and then take some action. In the past I have used cron for this but I was thinking this isn'

Re: Matching the domain of a URL

2007-03-14 Thread Igor Sutton Lopes
On 2007/03/14, at 16:00, yitzle wrote: regex. if ( m/^https?\/\/:blah\.com/) my @possible_values = qw{ http://www.google.com https://my.domain. http://some.other.domain.net }; my @urls = qw{ http://www.google.com/?some_bizarre_args https://my.domain.com https://my.domain.net h

Re: Perl-based content managers

2007-03-14 Thread Igor Sutton Lopes
On 2007/03/14, at 17:43, Tom Smith wrote: Thank for the reply... I actually use Twiki internally, for our Corporate Intranet. I have looked at Bricolage, but I don't think it suites my needs (though it looks like an awesome piece of software). The bottom line is that I'm not very profici

Re: Perl-based content managers

2007-03-14 Thread Igor Sutton Lopes
On 2007/03/14, at 17:13, Tom Smith wrote: I've been trying to find a good Perl-based content manager. There are a myriad of PHP ones available, complete with site design templates and such (like phpWebSite and Joomla)--but Perl-based ones seem to be pretty sparse. I was really hoping to

Re: How to revinent wget?

2007-03-14 Thread Igor Sutton Lopes
On 2007/03/14, at 16:10, siegfried wrote: I'm downloading a lot of debian images using wget these days. Can anyone suggest where I might look to find a little perl script that will download a web page, look for all the links containing ".iso" and then reinvent wget to download them all?

Re: Matching the domain of a URL

2007-03-14 Thread Igor Sutton Lopes
On 2007/03/14, at 15:55, Jeff Pang wrote: Hello, I just think regex is the best way since you choose to use Perl doing this work. Regexp::Common::URI may be what you're looking for. -- Igor Sutton [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: URL too long

2007-02-28 Thread Igor Sutton Lopes
Hi Tatiana, On 2007/02/28, at 16:57, Tatiana Lloret Iglesias wrote: Hi all, i have to browse a very long URL from my PERL script and it fails: http://appft1.uspto.gov/netacgi/nph-Parser? Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch- adv.html&r=0&p=1&f=S&l=50&Query=%28%22NRF3%22+AND+

Re: array operation

2007-02-26 Thread Igor Sutton Lopes
Hi, On 2007/02/26, at 11:08, [EMAIL PROTECTED] wrote: The above code does not seem to work for me. I get an error saying $" is unrecognised. do i need to include anything ? Actually, I'm using Perl 5.8.8. I don't know if 5.6 or lower has that variable. Actually, it does. If you are on unix

Re: array operation

2007-02-26 Thread Igor Sutton Lopes
Hi, On 2007/02/26, at 10:12, John W. Krahn wrote: print map "$_\n", @test; print "$_\n" for @test; Another solution is setting the $" variable: my @array = qw(1 2 3 4 5); { local $" = "\n"; print "@array"; } HTH! -- Igor Sutton [EMAIL PROTECTED] PGP.sig Description: This

Re: Home directory

2007-02-26 Thread Igor Sutton Lopes
directory. such as: C:\Documents and Settings\yantao USERPROFILE is the environment variable. You can also use the File::HomeDir module, that implements the abstraction for those operational systems. HTH! -- Igor Sutton Lopes <[EMAIL PROTECTED]> P

Re: Dynamically calling a subroutine

2007-02-12 Thread Igor Sutton Lopes
ackage main; my $function_name = "some_function"; if (my $coderef = M->can($function_name)) { $coderef->(); } Good luck! -- Igor Sutton Lopes <[EMAIL PROTECTED]> PGP.sig Description: This is a digitally signed message part

Re: Removing file extension

2007-01-23 Thread Igor Sutton Lopes
On 2007/01/23, at 11:03, Rob Dixon wrote: $file =~ s/(.*)\./$1/; or $file =~ s/\.[^.]*$//; If you know the suffix of the files you're working on, you can use the File::Basename module, more specific the fileparse function: use File::Basename; my @suffix = qw(.txt .zip .doc); my $filep

RES: Hash Question

2002-12-06 Thread Igor Sutton Lopes
You can do something like this: %url_options_hash = ("times_visited"=>0); %url_hash = ("this_url"=>\%url_options_hash); %usr_hash = ("igor"=>\%url_hash); print $usr_hash{"igor"}->{"this_url"}->{"times_visited"}, "\n"; $usr_hash{"igor"}->{"this_url"}->{"times_visited"} = 1; print $