Re: entering regular expressions from the keyboard

2007-08-21 Thread Paul Lalli
On Aug 20, 11:28 pm, [EMAIL PROTECTED] (Christopher Spears) wrote: I'm working on the second exercise of the second chapter. I'm supposed to write a program that asks the user to type a regular expression. The program then uses the regular expression to try to find a match in the directory

Re: Help needed with insignificant problem using format and write

2007-08-21 Thread Mathew Snyder
Chas Owens wrote: On 8/20/07, Mathew Snyder [EMAIL PROTECTED] wrote: Paul Lalli wrote: On Aug 20, 3:10 pm, [EMAIL PROTECTED] (Mathew Snyder) wrote: I run a script which creates a small report for different users of a system we have here at work. The report is a simple text document

Re: regex help

2007-08-21 Thread Mr. Shawn H. Corey
Jeff Pang wrote: -Original Message- From: Mr. Shawn H. Corey [EMAIL PROTECTED] Sent: Aug 21, 2007 12:32 PM To: Jeff Pang [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: regex help Jeff Pang wrote: my @new = map { $_-[0] } sort { $b-[1] = $a-[1] } map { [$_,(split/-/)[-1]] }

RE: regex help

2007-08-21 Thread Tony Heal
the list is a list of files by version. I need to keep the last 5 versions. Jeff's code works fine except I am getting some empty strings at the beginning that I have not figured out. Here is what I have so far. Lines 34 and 39 are provide a print out for troubleshooting. Once I get this fixed

Re: Help needed with insignificant problem using format and write

2007-08-21 Thread Chas Owens
On 8/21/07, Mathew Snyder [EMAIL PROTECTED] wrote: snip It would appear that for all but the first iteration, this is happening. However, something during the first time through seems to cause the flag to not be what it should. I've tried changing where the TOP is in the script, when it

RE: regex help

2007-08-21 Thread Tony Heal
Here is a sample of the versions that I am using. 16.1-17 16.1-22 16.1-23 16.1-39 16.3-1 16.3-6 16.3-7 16.3-8 16.3-15 16.5-1 16.5-2 16.5-10 16.5-13 15.3-12 15.2-108 14-special.1-2 14-special.1-8 14-special.1-15 14-special.2-40 14-special.2-41 14-special.3-4 14-special.3-7 14-special.3-12 15.2-110

Re: Help needed with insignificant problem using format and write

2007-08-21 Thread Mathew Snyder
Chas Owens wrote: On 8/21/07, Mathew Snyder [EMAIL PROTECTED] wrote: snip It would appear that for all but the first iteration, this is happening. However, something during the first time through seems to cause the flag to not be what it should. I've tried changing where the TOP is in the

Re: regex help

2007-08-21 Thread Chas Owens
On 8/21/07, Tony Heal [EMAIL PROTECTED] wrote: Here is a sample of the versions that I am using. snip Just to clarify, you have a version string with the following format: {major}{custom tag}.{minor}-{build} and you want the list sorted by major, then minor, then build. #!/usr/bin/perl use

RE: regex help

2007-08-21 Thread Jeff Pang
-Original Message- From: Tony Heal [EMAIL PROTECTED] Sent: Aug 21, 2007 9:25 PM To: [EMAIL PROTECTED], beginners@perl.org Subject: RE: regex help Here is a sample of the versions that I am using. 16.1-17 16.1-22 16.1-23 16.1-39 16.3-1 16.3-6 16.3-7 16.3-8 16.3-15 16.5-1 16.5-2 16.5-10

Re: regex help

2007-08-21 Thread Chas Owens
On 8/21/07, Jeff Pang [EMAIL PROTECTED] wrote: snip my @new = map { $_-[0] } sort { $b-[1] = $a-[1] or $b-[2] = $a-[2] or $b-[3] = $a-[3] } map { [ $_, split/\D+/ ] } @arr; snip While splitting on non-number is a nifty solution, it would break if the custom tag can contain a number

Re: regex help

2007-08-21 Thread Chas Owens
On 8/21/07, Jeff Pang [EMAIL PROTECTED] wrote: -Original Message- From: Chas Owens [EMAIL PROTECTED] Sent: Aug 21, 2007 10:01 PM To: Jeff Pang [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], beginners@perl.org Subject: Re: regex help On 8/21/07, Jeff Pang [EMAIL PROTECTED] wrote: snip

Re: regex help

2007-08-21 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] Sent: Aug 21, 2007 10:01 PM To: Jeff Pang [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], beginners@perl.org Subject: Re: regex help On 8/21/07, Jeff Pang [EMAIL PROTECTED] wrote: snip my @new = map { $_-[0] } sort { $b-[1] = $a-[1] or

RE: regex help

2007-08-21 Thread Tony Heal
OK I added this and I keep getting invalid format foreach (@newValues){print $_\n;} my @versions; while (@newValues) { chomp; die invalid format unless my ($major, $minor, $build) = /(\d+)(?:-.+)?\.(\d+)-(\d+)/;

RE: regex help

2007-08-21 Thread Tony Heal
OK I added this and I keep getting invalid format foreach (@newValues){print $_\n;} my @versions; while (@newValues) { chomp; die invalid format unless my ($major, $minor, $build) = /(\d+)(?:-.+)?\.(\d+)-(\d+)/;

LWP::Authen::Ntlm::authenticate

2007-08-21 Thread Michael Gale
Hey, Has anyone had any luck with NTLM auth with LWP ? It appears to repeat the following: --snip-- LWP::UserAgent::new: () --Performing request LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://employee.pason.com LWP::UserAgent::_need_proxy: Not proxied

Re: regex help

2007-08-21 Thread Chas Owens
On 8/21/07, Tony Heal [EMAIL PROTECTED] wrote: OK I added this and I keep getting invalid format foreach (@newValues){print $_\n;} my @versions; while (@newValues) { chomp; die invalid format unless my ($major,

Re: regex help

2007-08-21 Thread D. Bolliger
Tony Heal am Dienstag, 21. August 2007: -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 21, 2007 9:50 AM To: [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: regex help On 8/21/07, Tony Heal [EMAIL PROTECTED] wrote: Here is a

Multiline Input in Perl

2007-08-21 Thread ninad . 29
Hi, I am trying to take Multi Line Input in PERL. But unable to do that, pls let me know, how can i do that? for eg; I wanna take 3-4 strings from users, after every string user will pressenterand the next typed letters will go into some other string.. basically, i wanna take many strings from

Re: Multiline Input in Perl

2007-08-21 Thread Chas Owens
On 8/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I am trying to take Multi Line Input in PERL. But unable to do that, pls let me know, how can i do that? for eg; I wanna take 3-4 strings from users, after every string user will pressenterand the next typed letters will go into

Re: Multiline Input in Perl

2007-08-21 Thread Tom Phoenix
On 8/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am trying to take Multi Line Input in PERL. But unable to do that, pls let me know, how can i do that? Can you do single-line input in Perl? That would be a start. print What's your name? ; chomp(my $name = STDIN); print Hello,

Re: Multiline Input in Perl

2007-08-21 Thread Paul Lalli
On Aug 21, 1:13 pm, [EMAIL PROTECTED] (Chas Owens) wrote: On 8/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am trying to take Multi Line Input in PERL. But unable to do that, pls let me know, how can i do that? for eg; I wanna take 3-4 strings from users, after every string user

Re: entering regular expressions from the keyboard

2007-08-21 Thread Dr.Ruud
Jeff Pang schreef: Christopher Spears: print Enter regular expression: ; chomp(my $regexp = STDIN); $regexp = quotemeta($regexp); Since it specifically asks for a regular expression, I would definitely not do quotemeta(). #print $regexp; Make that print qr/$regexp/; -- Affijn, Ruud

Log4perl wrapper class

2007-08-21 Thread Robert Hicks
Cees posted this on Perlmonks and it works but I get [undef] for filename and line. sub get_logger { my $class = shift; my $module_name = shift; unless( Log::Log4perl-initialized ) { # watch the config file for changes (in seconds) Log::Log4perl-init_and_watch(

Perl Courses

2007-08-21 Thread John Arbes
Does anyone have any recommendations on Perl Courses either online or offline. I'm located in New York but, if a course is good enough, am willing to get away. I'm looking for both beginner and advanced recommendations. Also, please let me know if you have any opinions about HOTT's course:

Re: Perl Courses

2007-08-21 Thread hwigoda
stonehenge is the best. -Original Message- From: John Arbes [EMAIL PROTECTED] Sent: Aug 21, 2007 4:02 PM To: beginners@perl.org Subject: Perl Courses Does anyone have any recommendations on Perl Courses either online or offline. I'm located in New York but, if a course is good enough,

Re: Log4perl wrapper class

2007-08-21 Thread Robert Hicks
Robert Hicks wrote: Cees posted this on Perlmonks and it works but I get [undef] for filename and line. sub get_logger { my $class = shift; my $module_name = shift; unless( Log::Log4perl-initialized ) { # watch the config file for changes (in seconds)

perl include dependencies?

2007-08-21 Thread infobank
Hello, I'm trying to embed djabberd (perl5 net-im) onto a m0n0wall base (FreeBSD). I found scandeps, and ran it on DJAbberd and found some useful information about the modules it relies upon. Is there any way to find out which files it relies upon? Thanks, please let me know what other

How many Hits

2007-08-21 Thread neo80123
Hi, can anyone help me out? Code: foreach(@unsort) { ( $Sip, $Spo, $Dip, $Dpo, $Prot, $Dir ) = split( ',' ); foreach(@unsort) { if (index($_,$Sip)-1 and $Dir==0) { $unsort[0] =~ s/$Sip//;

Re: How many Hits

2007-08-21 Thread Jeff Pang
-Original Message- From: neo80123 [EMAIL PROTECTED] Sent: Aug 21, 2007 10:01 PM The input is sth like that 51,34,55,45.0 or 34,45,123,55,0. I want to find out how often Number 55 exists. No matter on what position the 55 is. Hello, Use a hash to count the numbers.Like, $ perl -e '

Re: How many Hits

2007-08-21 Thread John W. Krahn
neo80123 wrote: Hi, Hello, can anyone help me out? Maybe, it depends on how well you describe your problem. Code: You should start your code with the two pragmas: use warnings; use strict; foreach(@unsort) { ( $Sip, $Spo, $Dip, $Dpo, $Prot, $Dir ) = split( ',' ); You are

CGI Help

2007-08-21 Thread Tony Heal
I want to run a cgi script from another server inside a local cgi page SSI will only do local files, not remote URLs. How can I do this? Tony Heal Pace Systems Group, Inc. 800-624-5999 [EMAIL PROTECTED]

Re: CGI Help

2007-08-21 Thread Jeff Pang
-Original Message- From: Tony Heal [EMAIL PROTECTED] Sent: Aug 22, 2007 11:37 AM To: beginners@perl.org Subject: CGI Help I want to run a cgi script from another server inside a local cgi page SSI will only do local files, not remote URLs. How can I do this? How about using a

regexp /g question

2007-08-21 Thread Alexandru Maximciuc
Hello, could someone please explain me these results: use strict; use warnings; my $re = qr!a!; $_ = join '', DATA; print 1) .scalar($_ =~ /$re/g).\n; my @a = $_ =~ /$re/g; print 1) .scalar(@a).\n; __DATA__ jaskdgbanio ehioa sdoija oihfcasoi dnfmalmods gnijashdugoiahisr

Syntax error?

2007-08-21 Thread Chris
I am working a script that is a solution to a problem in Intermediate Perl. Here is the script: #!/usr/bin/perl -w use strict; sub check_items_for_all { my $all_ref = @_; my @who = keys %$all_ref; my @required = qw(preserver sunscreen water_bottle jacket); my

Re: Syntax error?

2007-08-21 Thread yitzle
On 8/22/07, Chris [EMAIL PROTECTED] wrote: I am working a script that is a solution to a problem in Intermediate Perl. Here is the script: #!/usr/bin/perl -w use strict; sub check_items_for_all { my $all_ref = @_; my @who = keys %$all_ref; my @required =

Re: regexp /g question

2007-08-21 Thread yitzle
Explained here: http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators-operator%2c-regexp On 8/22/07, Alexandru Maximciuc [EMAIL PROTECTED] wrote: Hello, could someone please explain me these results: use strict; use warnings; my $re = qr!a!; $_ = join '',

Re: Syntax error?

2007-08-21 Thread Alexandru Maximciuc
Hello Chris, Wednesday, August 22, 2007, 7:44:02 AM, you wrote: I am working a script that is a solution to a problem in Intermediate Perl. Here is the script: #!/usr/bin/perl -w use strict; sub check_items_for_all { my $all_ref = @_; here is the first err: you should have

Re[2]: regexp /g question

2007-08-21 Thread Alexandru Maximciuc
Hello yitzle, Wednesday, August 22, 2007, 7:51:22 AM, you wrote: Explained here: http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators-operator%2c-regexp On 8/22/07, Alexandru Maximciuc [EMAIL PROTECTED] wrote: Hello, could someone please explain me these results: