(End this thread) Re: Fwd: Fw: PLEEEEEEEASE READ!!!

2001-12-03 Thread Curtis Poe

End this thread, please.  If you have something to say to this individual, please do 
so privately.
 Yes, the spam was innapropriate, but I find it a bit ironic that the spam-haters have 
generated
so much, uh, spam.

--- lynn bui [EMAIL PROTECTED] wrote:
 hey,
 
 this does not concern perl, but maybe you should read
 it.
 it may be true and if so it's a really good deal.
 
 Note: forwarded message attached.
 
 
 

 ATTACHMENT part 2 message/rfc822 
 Date: Thu, 29 Nov 2001 17:20:22 -0800 (PST)
 From: michael tran [EMAIL PROTECTED]
 Subject: Fwd: Fw: PLEEEASE READ!!!
 To: [EMAIL PROTECTED]
 
 
 Note: forwarded message attached.
 
 
 __
 Do You Yahoo!?
 Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
 http://geocities.yahoo.com/ps/info1

 ATTACHMENT part 2.2 message/rfc822 
 From: christopher browning [EMAIL PROTECTED]
 To: [EMAIL PROTECTED], jennifer r [EMAIL PROTECTED],
Dr. Mike Carroll [EMAIL PROTECTED],
Dr. Michael Tran [EMAIL PROTECTED],
David/Carrie Cho [EMAIL PROTECTED],
Danny  Peggy Hoosier [EMAIL PROTECTED],
Daniel G. Hoosier [EMAIL PROTECTED], [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
melanie jessup [EMAIL PROTECTED],
Lisa Louise Browning [EMAIL PROTECTED], [EMAIL PROTECTED],
Glen Campbell [EMAIL PROTECTED],
elizabeth  Merriman [EMAIL PROTECTED],
Dr. Tina Benson- Entwistle [EMAIL PROTECTED],
Dr. Jason Boudrea [EMAIL PROTECTED],
Doyle Wayne Morse,Jr. [EMAIL PROTECTED],
Doug Murphy [EMAIL PROTECTED],
Don and Tina Entwistle [EMAIL PROTECTED],
Don \You Could Had DIS...\ Entwistle [EMAIL PROTECTED]
 Subject: Fw: PLEEEASE READ!!!
 Date: Mon, 26 Nov 2001 18:28:56 -0500
 
 Hey everyone,
 
 Forward this, it REALLY works.  I know a lady who got a BIG check!  All that
 money for just forwarding this beta test for AOL!
 
 CB
 - Original Message -
 From: Bonsky, Adam [EMAIL PROTECTED]
 Sent: Monday, November 19, 2001 11:48 AM
 Subject: FW: PLEEEASE READ!!!
 
 
 
  Show me the money!  (and monkey's will fly out of my)
 
  -Original Message-
  From: Craig [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 16, 2001 6:18 PM
  To: Nicole Hric; Monkey Boy; Joe Bibro; Ilene Snider; Fab Ass; Dorene
  Kaczmarek; darrin; Dad; Brandon; Bonsky, Adam; Beth Anthony; Andrew
  Bonsky; Amy Smith; Ammar; Adam Bonsky
  Subject: Fw: PLEEEASE READ!!!
 
 
 
  - Original Message -
  From: Engel, Craig A [EMAIL PROTECTED]
  To: Wasilewski, John [EMAIL PROTECTED]; Smith, Amy
  [EMAIL PROTECTED]; Smith, David S [EMAIL PROTECTED];
  Abrigo, Dianne [EMAIL PROTECTED]; McNaughton, Owen
  [EMAIL PROTECTED]; Girard, Denise [EMAIL PROTECTED];
  [EMAIL PROTECTED]; Collings, Katie [EMAIL PROTECTED];
  Grasso, Kim R [EMAIL PROTECTED]; Ives, Roberta
  [EMAIL PROTECTED]
  Sent: Friday, November 16, 2001 11:40 AM
  Subject: FW: PLEEEASE READ!!!
 
 
 
  -Original Message-
  From: herb/nancy weinfeld [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, November 01, 2001 1:13 PM
  To: gary weinfeld; michael weinfeld; Michelle Johnson; Larry Jonhson;
  Lucille Sid Goldberg; Anita Mort Weinerman; Lee Zakower; Janice/Doris
  Stuart; Joan  Ed Berman; Paul LuLu Prager
  Subject: Fw: PLEEEASE READ!!!
 
 
 
  -Original Message-
  From: greene  [EMAIL PROTECTED]
  To: Cutler, Anita  [EMAIL PROTECTED]; Belson, Kim 
  [EMAIL PROTECTED]; Belson, Roberta  [EMAIL PROTECTED]; Bob, Marianne
   [EMAIL PROTECTED]; Cohen, Felice  [EMAIL PROTECTED]; Coltin,
  Debbie  [EMAIL PROTECTED]; Dolan Family  [EMAIL PROTECTED]; Dunkel
  Cindy  Shelly  [EMAIL PROTECTED]; Erica Greene  [EMAIL PROTECTED];
  Goldberg, Alan  [EMAIL PROTECTED]; Goldberg, Leslie 
  [EMAIL PROTECTED]; Greene, Erica  [EMAIL PROTECTED];
  greene, leslie  [EMAIL PROTECTED]; greene, mike 
  [EMAIL PROTECTED]; Kline, Carol  [EMAIL PROTECTED]; Kline, Hy 
  [EMAIL PROTECTED]; Kline, Marisa  [EMAIL PROTECTED]; Kline, Pam 
  [EMAIL PROTECTED]; Kline, Steven  [EMAIL PROTECTED]; Kline, Stuart 
  [EMAIL PROTECTED]; Shuman, Merle  [EMAIL PROTECTED]; Steyer, Joyce 
  [EMAIL PROTECTED]
  Date: Wednesday, October 31, 2001 9:54 PM
  Subject: Fw: PLEEEASE READ!!!
 
 
 
  - Original Message -
  From: The  mailto:[EMAIL PROTECTED] Gustats
  To: ALAN  mailto:[EMAIL PROTECTED]  GAIL GREENBERG ; Cindy Greene
  mailto:[EMAIL PROTECTED]  ; Mike B  mailto:[EMAIL PROTECTED]
  Gustat ; MARYELLEN mailto:[EMAIL PROTECTED]  ; Bernie Pickard
  mailto:[EMAIL PROTECTED]  ; Gary SOREFF mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 31, 2001 9:12 PM
  Subject: Fw: PLEEEASE READ!!!
 
 
  -Original Message-
  From: Richard Shurtleff  [EMAIL PROTECTED]
  To: Stephen  Denise Meisner  [EMAIL PROTECTED]; Stacey
  Spyropoulos  [EMAIL PROTECTED]; Michael Gentilucci 
  [EMAIL PROTECTED]; Merle  Larry Shulman  [EMAIL PROTECTED]; Lloyd 
  Pat Duperre  [EMAIL PROTECTED]; Fran Gentilucci  [EMAIL 

CGI and NAME v. ID

2001-12-03 Thread Lisa Nyman

Hi,


The HTML4 spec reads:

Each scripting language has its own conventions for referring to HTML
objects from within a script. This specification does not define a
standard mechanism for referring to HTML objects. However, scripts should
refer to an element according to its assigned name. Scripting engines
should observe the following precedence rules when identifying an
element: a name attribute takes precedence over an id if both are
set. Otherwise, one or the other may be used.

I looked this up because someone handed me a script which used the ID
attribute of an INPUT element with a param() call to retrieve the INPUT's
value.  In my tests on Apache, this didn't work.  My assumption is that ID
cannot be used to assign a name to a form element, or at least CGI.pm
won't pick it up.

Does anyone have any insight to this?

-lisa


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: (End this thread) Re: Fwd: Fw: PLEEEEEEEASE READ!!!

2001-12-03 Thread Scott R. Godin

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Curtis Poe) wrote:

 End this thread, please.  If you have something to say to this individual, 
 please do so privately.
  Yes, the spam was innapropriate, but I find it a bit ironic that the 
  spam-haters have generated
 so much, uh, spam.

{MASSIVE snippage}

uh, not to mention REAMS of attributes and quoted text (ugh) that were 
better left unposted. =:P

print pack H*, 4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




another weather question, kinda

2001-12-03 Thread Nate Brunson

ok so im still working away on this weather thing(i would like to thank mark solomon, 
if he ever reads this stuff, for writing a great weather modual!!!) but im searching a 
variable for a certain phrase, its not finding it, but i know its there, and i cant 
figure out whats not matching,(i suck at regular expressions) so look at this:

$currentW = qw(At 4:00 PM, Orlando Exec, FL conditions were fair weather at  79°F wind 
was north at 9 mph. The relative humidity was  52%, and barometric pressure was steady 
from 30.13 in.);


%skies = (
   'SUNNY'  = 'sunny skies',
   'MOSUNNY'= 'mostly sunny skies',
   'PTSUNNY'= 'partly sunny skies',
   'CLEAR'  = 'clear weather',
   'DRIZZLE'= 'a drizzle',
   'CLOUDY' = 'cloudy skies',
   'MOCLDY' = 'mostly cloudy skies',
   'PTCLDY' = 'partly cloudy skies',
   'LGT RAIN'   = 'light rain',
   'FRZ DRZL'   = 'freezing drizzle',
   'FLURRIES'   = 'flurries',
   'LGT SNOW'   = 'light snow',
   'SNOW'   = 'snow',
   'N/A'= 'N/A',
   'NOT AVBL'   = '*not available*',
   'FAIR'   = 'fair weather');

foreach $key (keys(%skies)){
 if ($currentW =~ m/'$skies{$key}'/){
  $sky = $key;
 }
}

if you can see what the im missing help me out, 
thanx a billion 

nate



never mind

2001-12-03 Thread Nate Brunson

ok i figured out what i did wrong, no need to reply..

thnx
nate



Re: removing underscores based on quantity

2001-12-03 Thread John W. Krahn

Hanson wrote:
 
 Hi!
 
 I need to remove the first n underscores from various
 strings if there are more than two currently present in the
 string. The total number of underscores will vary. For
 example, if I have the following strings:
 
 $a = Now_is_the_time_for_all
 $b = The_quick_brown_fox_jumped
 $c = foo_bar_baz
 
 I need to change them to:
 
 $a = Nowisthetime_for_all
 $b = Thequickbrown_fox_jumped
 $c = foo_bar_baz # No change required.


#!/usr/bin/perl -w
use strict;

while ( DATA ) {
my $count = tr/_//;
my $num_to_remove = $count - 2;

if ( $count  2 ) {
s/_// while $num_to_remove--;
}
print;
}

__DATA__
Now_is_the_time_for_all
The_quick_brown_fox_jumped
foo_bar_baz



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Mail::Mailer Bcc problem

2001-12-03 Thread Jenda Krynicky

From: Michael Fowler [EMAIL PROTECTED]
 On Fri, Nov 30, 2001 at 10:24:24AM -0600, Kanchana Weerasinghe wrote:
  I have a problem using Mail::Mailer with a Bcc in the headerthe
  recipient (To) can see the Bcc field in the email header.
 
 This is a problem with your MTA (mail transport agent; e.g. sendmail,
 postfix, qmail, etc.), i.e. $server.  It's the MTA's job to remove the
 header, not Mail::Mailer's.

I don't think so. AFAIK SMPT servers only add a few lines (routing 
info) to the headers. Other than that they are not interested in the 
headers at all (except maybe checking the headers length to 
prevent infinite looping).

Your script/module should NOT SEND the Bcc: header at all.
It should only use the addresses from the Bcc: parameter during 
the SMTP conversation:

mail from: ...
rcpt to: ...
rcpt to: ...
...

I think if you used sendmail as the type than it would strip the 
Bcc: header while parsing it for the addresses to send the mail to, 
but if you use SMTP then it's the script/module's task.

I think you'll have to contact the Mail::Mailer's author (or fix this 
yourself).

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Passing parameters from one cgi script to another?

2001-12-03 Thread Mei Leng Lee


Hi,

I'm trying to pass some parameters from one script to another. I know
there's some perl module which can do that. But it's not install in the
system and I don't have the permission to install it either. Is there any
other way to do it? 

Virginia


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




SafePerl

2001-12-03 Thread Jules

Our web server enables us to use 'SafePerl' for CGI scripts. I can find
little information relating to this, and what subset of Perl commands are
enabled (or correctly, which commands are disabled).
Can anyone point me in the right direction?

Julian



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Hello, how to tell if I have perl DBI?

2001-12-03 Thread Jonathan Gardner

On Sunday 02 December 2001 11:43 am, [EMAIL PROTECTED] wrote:
 I'm  just trying to tell if dbi itself is installed or not. I guess I  have
 to go to the  mysql site and download it, but do I install the DBI for perl
 or since I am using mysql *just* the specified DBD for mysql? That's what
 is confusing me. Dbi I thought would do it, but then I see a db*d*, not dbi
 for mysql. So does that mean I need both or just one?

 Wow, I bet this is so easy 100's are laughing ;)

$ perl -MCPAN -e shell

This is why perl is so great - CPAN. That is why 100's are laughing. It is so 
natural to them they can't imagine NOT using it.

You'll want to do something like:

(from the CPAN shell)
 install DBI
 install DBD::whatever you need

Be sure to become intimately familiar with CPAN. It is your friend. If you 
are running it for the first time, you may want to do install bundle::CPAN or 
something like that.

As to whether something is installed:

$ perl -Mmodule
^D

If it comes up with a bunch of garbage, it's not installed.
If it wants you to type something in, just press CTRL-D. It is installed. 

Jonathan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Threads and external commands.

2001-12-03 Thread Gustavo Zambon Rozatti

Hi, I had just subscribed this list.
I made a perl script that uses Threads and external command
(system() function). It uses to run fine at an linux machine with 2.2.16
kernel and Perl 5.6.1.
I had migrated this script to another machine with linux and 2.4.7
kernel, but still Perl 5.6.1 and the script just stop before the line that
calls the system() function.
Had anyone seen some like this?
Thanks in advance.

[]´s
Gustavo.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




what is a structure

2001-12-03 Thread [EMAIL PROTECTED]

hi all,
i have two questions, and would appriciate if someone could tell
me where i can find answers to them.

1. what is a structure and where i can find information
on what a structure is (as used in the code below)

2. how does the following line work:  $SummaryPerWeek+= data from select
i.e. how is the data from select get inserted into data from select

==code below==
TrafficPerWeekHour_Check_Hour( $ )
{
# The subroutine checks whether record for
# the specified week and hour exists

select from trafficperweekhour where time=$Record-{time}

# if it doesn't exist - we need to add it:

  ## TrafficPerWeekHour_Fill_Hour( $ )

  structure SummaryPerWeek=0
  $WeekDay=0 # Sunday
  while ( $WeekDay  7 )
  {
select from trafficperhour where
time=($Record-{time}+$WeekDay*3600*24);
$SummaryPerWeek+= data from select
$WeekDay++;
  }
  SummaryPerWeek/=7;
  insert into trafficperhour values $SummaryPerWeek where
time=$Record-{time}
}

=

-- 
  - josh
N8MSO

20A8 2FC6 9099 D215 78F4 D005 B9F3 21C4 300C C25E~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - [EMAIL PROTECTED] - tel: +972.58.520.636, http://www.tkos.co.il


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Passing parameters from one cgi script to another?

2001-12-03 Thread Jenda Krynicky

 I'm trying to pass some parameters from one script to another. I know
 there's some perl module which can do that. But it's not install in
 the system and I don't have the permission to install it either. Is
 there any other way to do it? 
 
 Virginia

You don't need access to the common library directories to be able to install modules. 
Create your own directory, install the modules into it and add
use lib '/path/to/my/lib/directory';
on top of the scripts that need one of those libraries.

To encode the values so that they may be passed in the query string you may use eg. 
CGI::Enurl ( http://Jenda.Krynicky.cz )

use CGI::Enurl;
print Location: http://www.yourserver.com/cgi-bin/script.pl?.enurl( 
\%params);

To install it you only have to copy Enurl.pm into /path/to/my/lib/directory/CGI 
directory.

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




CGI on a Novelle box

2001-12-03 Thread Purshottam Chandak

We have a Unix server for our internet applications, but I am reluctant to
do development work on it, being so new to Perl and we do not have another
Unix server. Can I write and test CGI applications on a Novelle server? If
so, what would I need to do - just install Perl on the server and then call
my programs in a cgi_bin directory?

Pc



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




child ksh script that updates %ENV

2001-12-03 Thread Michael McQuarrie

Does anyone know of a wrapper that could be put around
a ksh script, run as a child of a perl script, that
could update the %ENV hash with the chages made by the
ksh script.

Michael McQuarrie

__
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Passing parameters from one cgi script to another?

2001-12-03 Thread Brett W. McCoy

On Mon, 3 Dec 2001, Mei Leng Lee wrote:

 I'm trying to pass some parameters from one script to another. I know
 there's some perl module which can do that. But it's not install in the
 system and I don't have the permission to install it either. Is there any
 other way to do it?

Pass them in what way that isn't the normal way to pass parameters into a
CGI script?  Are you using CGI.pm?  It comes atdnard with every Perl
distrobution out there.

-- Brett
  http://www.chapelperilous.net/

You have a truly strong individuality.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Separating and parsing data

2001-12-03 Thread Sean Patterson

I just started learning Perl.  I need help in writing a solution for the 
following:

# Write data validation routines to -
#   Ignore blank lines...
#   Ignore comments...
#   Ignore complete pod sections
#   Process the following data, as described:


792910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://www.fccj.org/~wcjones/|Bill's Home Page
552910171010163200|http://www.jacksonville.net/sneex/|My Home Page
552913171010163200|http://jacksonville.pm.org/|Jax.PM Home Page
552909171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552909171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://web.fccj.org/~bill/|WCJones Home Page
552910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171011163200|http://sneex.fccj.org/|WCJones Home Page
552910171011163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171012163200|http://www.fccj.org/|FCCJ Home Page

#End of Assignment...

Here is what I have done so far:

#!C:/Perl/bin/Perl.exe -w

use strict;
use diagnostics;

my ($line, $time, $url, $title);
my @list;

while (DATA) {
chomp;  # To remove newlines
# To delete blank lines  I have to write this

s/#.*//;# To remove comments

my @list = $_;

foreach $line (@list) {
($time, $url, $title)=split(/|/, $line); # this does not seem to work
print $line\n;
}

}

sleep  5;

__END__

Thank you so much for your help.

Sandeep

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Update: Separating and parsing data

2001-12-03 Thread Sean Patterson

I just started learning Perl.  I need help in writing a solution for the 
following:

# Write data validation routines to -
#   Ignore blank lines...
#   Ignore comments...
#   Ignore complete pod sections
#   Process the following data, as described:

792910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://www.fccj.org/~wcjones/|Bill's Home Page
552910171010163200|http://www.jacksonville.net/sneex/|My Home Page
552913171010163200|http://jacksonville.pm.org/|Jax.PM Home Page
552909171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552909171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://web.fccj.org/~bill/|WCJones Home Page
552910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171010163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171011163200|http://sneex.fccj.org/|WCJones Home Page
552910171011163200|http://web.fccj.org/~wcjones/|WCJones Home Page
552910171012163200|http://www.fccj.org/|FCCJ Home Page

Here is the data validation description to my previous email:

=head1 TEMP # To ignore pod...cut statementsthis does not work though
Format of the above:

The | (pipe) is a data field (HINT: split) separator;

The 552910171010163200 which is Sat Nov 17 10:29:55 2001,
(HINT: localtime) should be parsed into HH:MM:SS (Zero padded) and
WDay MMM DD,  - which should look like Sat Nov 17, 2001
55: 29:  10: 17:10:  101: 6:  320:0
HH:MM:SS:17:Nov: year (1900 +101= 2001):Sat:  320thday of the year
The rest of the line is a URL and URL Comment

This data should be validated for -

Correctness of time, of date, and check to see if the URL
is reachable.


#End of Assignment...



Here is what I have done so far:

#!C:/Perl/bin/Perl.exe -w

use strict;
use diagnostics;

my ($line, $time, $url, $title);
my @list;

while (DATA) {
chomp;  # To remove newlines
# To delete blank lines  I have to write this

s/#.*//;# To remove comments

my @list = $_;

foreach $line (@list) {
($time, $url, $title)=split(/|/, $line); # this does not seem to work
print $line\n;
}

}

sleep  5;

__END__

Thank you so much for your help.

Sandeep
[EMAIL PROTECTED]

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Delete all event in th even tlog

2001-12-03 Thread Jorge Goncalvez

I use the WIn32::EventLog and I wonder how to delete all event logs elements
I have this code:
#!/usr/local/bin/perl -w

use Win32::EventLog;
use File::stat;
use File::Find;
use strict;



my ($Event, @timearray, $filename,
$day, $month, $directory, $logfile, $fileage);

my $retrycount = 0;

#  Where do you want to put the backup files?

$directory = 'c:/Support/EventLogs/';

for ('Application', 'System', 'Security' )   {
 $retrycount = $retrycount + 1;
 if ($retrycount = 30 ) {$retrycount = 0; next};
 $Event = new Win32::EventLog ($_, );
 @timearray=localtime(time);
 $month = sprintf ('%.2d', $timearray[4] +1);
 $day = sprintf ('%.2d', $timearray[3]);
 $filename = $directory . ($timearray[5]+1900) . '_' .
   $month . '_' . $day . '_' . $_ . '.evt';
 print $filename\n;
 unless ($Event-Clear($filename)) {sleep 5; redo};
 $retrycount = 0;
 #`gzip -9 $filename`;
}

But it seems not to work what s wrong?
Thanks
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




perl install

2001-12-03 Thread tom poe

Hi:  I am running SuSE7.1 with perl5.6.0 default install.  Directory = 
/usr/bin/perl

I went to CPAN, and ran install::perl, or something, and now have perl5.6.1 
installed in:  /usr/local/bin/perl

Well, this has led to a lot of confusion for @INC.  Seems like one of the 
options is to install everything as I go along into 5.6.1, or clean up by 
removing everything associated with 5.6.0.  Just seems like there should be 
an easier solution, possibly a symlink?  Any thoughts?  Thanks, Tom

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:delete all files under a directory

2001-12-03 Thread Jeff 'japhy' Pinyan

On Dec 3, Jorge Goncalvez said:

Hi, I wonder How to delete all files under a directory in Perl

  use File::Path;
  rmtree([/some/directory]);

perldoc File::Path

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:delete all files under a directory

2001-12-03 Thread Hasanuddin Tamir

On Mon, 3 Dec 2001, Jorge Goncalvez [EMAIL PROTECTED] wrote,

 Hi, I wonder How to delete all files under a directory in Perl
  Thanks.

This one does it, but not recursively, and only real files, not
directories.

perl -e 'unlink *'


san
-- 
Trabas - http://www.trabas.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Getting IP info on a Win32 platform

2001-12-03 Thread Craig S Monroe

I looked in PPM, but could not find a package that seemed to match.
I am looking for  a package that helps access the IP info on a windows
machine.
Any direction or help would be great. Thanks.
Craig
[EMAIL PROTECTED]
Pager
Numeric: 1-877-895-3558
Email pager: [EMAIL PROTECTED]
--
You will never find time for anything.
If you want time, you must make it.

Charles Buxton



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




permanently modify a hash key?

2001-12-03 Thread Mark Hanson

Hi!

Yet another hash question:

How can I permanently modify a hash key? I have the following hash:

my %hash = ( 
hygiene_products_total_amount = {
'conditioner' = 5, 
'shampoo'   = 57,
'soap'  = 1, 
},  
cleaning_products_total_amount = {   
'mops' = 20,
},  
);

I tried the following which prints out the correct value, but doesn't permanently 
modify the key.

#removing all but two underscores
foreach (keys %hash) { 
$count = $_ =~ s/(_)/$1/gi;   
while (($count = $_ =~ s/(_)/$1/gi)  2) {
$_ =~ s/_//;  
} 
print \n$_\n;   
}   

Any help is appreciated. Thanks!

/Mark



Re: permanently modify a hash key?

2001-12-03 Thread Peter Scott

At 12:41 PM 12/3/01 -0600, Mark Hanson wrote:
How can I permanently modify a hash key?

Delete the original element and add a new one.

 ($newkey = $oldkey) =~ s/foo/bar/;
 $hash{$newkey} = delete $hash{$oldkey};

This isn't something I find myself doing at all often.  Doing so *may* be a 
sign of a suboptimal design.

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: perl install

2001-12-03 Thread Trap 13

On Mon, Dec 03, 2001 at 09:10:25AM -0800, tom poe wrote:
 Hi:  I am running SuSE7.1 with perl5.6.0 default install.  Directory = 
 /usr/bin/perl
 
 I went to CPAN, and ran install::perl, or something, and now have perl5.6.1 
 installed in:  /usr/local/bin/perl
 
 Well, this has led to a lot of confusion for @INC.  Seems like one of the 
 options is to install everything as I go along into 5.6.1, or clean up by 
 removing everything associated with 5.6.0.  Just seems like there should be 
 an easier solution, possibly a symlink?  Any thoughts?  Thanks, Tom
 

I suppose that Suse, like any other good Linux distribution has a
package tool, I guess it is called Yast.

If you want to update your perl package, first check Suse web site,
they perhaps have a package with the last perl version.

It they don't, first uninstall the perl package with Yast, and install
yourself the tarball as you did it previously. The default place
(/usr/local) is generally a good one for programs that don't belong
to the distribution packages.

 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-- 
Ce qu'il y a d'enivrant dans le mauvais goût, c'est le plaisir
aristocratique de déplaire.

Charles Baudelaire - Mon coeur mis à nu.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Separating and parsing data

2001-12-03 Thread Trap 13

On Mon, Dec 03, 2001 at 03:00:39PM +, Sean Patterson wrote:
 I just started learning Perl.  I need help in writing a solution for the 
 following:
 

[ ..zap.. ]

 
   foreach $line (@list) {
   ($time, $url, $title)=split(/|/, $line); # this does not seem to work

You have to escape the | which has a special meaning with a \ :

($time, $url, $title)=split(/\|/, $line); # this works


-- 
Ce qu'il y a d'enivrant dans le mauvais goût, c'est le plaisir
aristocratique de déplaire.

Charles Baudelaire - Mon coeur mis à nu.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Need help with workweek to week dates ...

2001-12-03 Thread C.E.O.

My company uses a custom workweek that begins 
at Midnight on Saturday and ends on Friday at 23:59:59.99.

I need a subroutine that can take as input a workweek (12, 26, 36)
and take as input a year (2002, 2003, 2004) all in the same 
operation. Then I need the subroutine to return values as  
custom workweek dates, like ...

For workweek 12 of 2002, the return values would be ..

16-MAR-2002, 17-MAR-2002, 18-MAR-2002, 19-MAR-2002, 20-MAR-2002, 
21-MAR-2002, 22-MAR-2002.

For workweek 26 of 2003, the return values would be ..

21-JUN-2003, 22-JUN-2003, 23-JUN-2003, 24-JUN-2003, 25-JUN-2003,
26-JUN-2003, 27-JUN-2003.

For workweek 36 of 2004, the return values would be ..

28-AUG-2004, 29-AUG-2004, 30-AUG-2004, 31-AUG-2004, 1-SEP-2004,
2-SEP-2004, 3-SEP-2004.

I can take a yearday and get a workweek number like ..

March 25th is the 85th day of the year, if there is no leap year that year.

(85/7)+1 = 13.14285714

So I know it's in workweek 13. I can take 7*.14285714 and get approximately 1.
Assuming that Zero is Sunday, I can match up 1 with Monday and so on.

My problem is that the custom workweek starts on Saturdays.

Any help/code examples are really appreciated,

~




 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




system `ls` or File::Find?

2001-12-03 Thread Wright, Thomas

Hi folks.

I need to select a single file name from a list of filenames and assign it
to a variable.


I currently do this in a few shell scripts using: $last_file=`ls -1r
somedata_file.dat.*.orig | head -1`

The * represents a timestamp in the filename. This allows me to select the
most recent file, in this case.


as an example, this would return a value such as :
somedata_file.dat.20011203130101.orig which would be stored in $last_file




When I do this in Perl thusly:

$oldfile = `system ls -1r $oldfile.\*.orig | head -1`;

Where $oldfile contains the first part of a filename passed in via
Getopt::Long .

$oldfile is empty. I think it contains the return value from the call to the
system, so I am not properly assigning the output value, (the single
filename), to it.

I verify that $oldfile does contain a value with a print statement
immediately prior to the statement with 'system' in it.


Am I somehow stepping on $oldfile by using it to re-assign a new value to
itself?

Am I screwing up on the various tic's?

How can I do this? 

Should I use File::Find? If so, how? I have not been able to find how to do
this with File::Find in any of the O'Reilly books or on the web.




Thanks,
Tom Wright



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: system `ls` or File::Find?

2001-12-03 Thread Daniel Gardner


Monday, December 03, 2001, 8:14:48 PM, Wright, Thomas wrote:

WT When I do this in Perl thusly:

WT $oldfile = `system ls -1r $oldfile.\*.orig | head -1`;

you want to use system *or* backticks, not both.

  $oldfile = `ls|head`;

should do the trick

here's something that will do it just in perl. very naive though -
it's going to call stat() about a million times (which is bad)

  $oldfile = (sort { (stat $b)[9] = (stat $a)[9] } * )[0];

i'd say that if you're happy with the shell way then stick with it -
it's going to make far more sense to you, and whoever has to maintain
the script later.

  
-- 
Best regards,
 Danielmailto:[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




add hash to hash of hash

2001-12-03 Thread Mark Hanson

Hi,

Still more hash questions: 

using the example in chapter 9 of Programming Perl:

%HoH = (
flintstones = {
husband=fred,
pal=barney,
},
);

how can dynamically add another hash to %HoH? In Programming Perl, they have a hard 
coded example:

$HoH{mash} = {
captain = pierce,
...
};

I've tried: 
$HoH{'mash'}{'captain'} = {'pierce'};
and assorted variations...

Pls help! Thanks!
/Mark





RE: add hash to hash of hash

2001-12-03 Thread Bob Showalter



 -Original Message-
 From: Mark Hanson [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 03, 2001 4:42 PM
 To: [EMAIL PROTECTED]
 Subject: add hash to hash of hash
 
 
 Hi,
 
 Still more hash questions: 
 
 using the example in chapter 9 of Programming Perl:
 
 %HoH = (
 flintstones = {
 husband=fred,
 pal=barney,
 },
 );
 
 how can dynamically add another hash to %HoH? In Programming 
 Perl, they have a hard coded example:
 
 $HoH{mash} = {
 captain = pierce,
 ...
 };
 
 I've tried: 
 $HoH{'mash'}{'captain'} = {'pierce'};
 and assorted variations...

Close. use:

   $HoH{mash}{captain} = 'pierce';

{'pierce'} is an anonymous hash with 1 key (pierce) and a
missing value, which will default to undef. So your statement
is equivalent to:

   $Hoh{mash} = { captain = { pierce = undef } };

-w or use warnings will issue a warning when you use
something like {'pierce'}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: system `ls` or File::Find?

2001-12-03 Thread Bob Showalter

 -Original Message-
 From: Wright, Thomas [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 03, 2001 3:15 PM
 To: Beginners (E-mail)
 Subject: system `ls` or File::Find?
 
 
 Hi folks.
 
 I need to select a single file name from a list of filenames 
 and assign it
 to a variable.
 
 
 I currently do this in a few shell scripts using: $last_file=`ls -1r
 somedata_file.dat.*.orig | head -1`
 
 The * represents a timestamp in the filename. This allows 
 me to select the
 most recent file, in this case.
 
 
 as an example, this would return a value such as :
 somedata_file.dat.20011203130101.orig which would be stored 
 in $last_file
 
 
 
 
 When I do this in Perl thusly:
 
 $oldfile = `system ls -1r $oldfile.\*.orig | head -1`;

You're combining backticks and system(). Just use the backticks:

  $oldfile = `ls -lr $oldfile.*.orig | head -1`

 ...
 
 How can I do this? 

You can avoid the two external programs and use Perl's globbing
capability. Something like this will work:

   $oldfile = (sort {$b cmp $a} $oldfile.*.orig)[0]

How this works:

   $oldfile.*.orig is a glob, returning a list of filenames
   sort {$b cmp $a} sorts the list in reverse order
   (...)[0] takes the first element of the list (i.e. last file)

Beware that since $oldfile is passed in by the user, it should
be checked for naughty characters before passing to ls or glob(). 
You may want to use -T switch to enable taint checking.

 
 Should I use File::Find? If so, how? I have not been able to 
 find how to do
 this with File::Find in any of the O'Reilly books or on the web.

perldoc File::Find has all the poop. Sounds like you really don't
need it here, though.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Returning a text string

2001-12-03 Thread Dean Theophilou

Hello:

I would like to exit a perl program such that upon exiting, it will return a
text string to the calling program.  How would I go about doing this?

exit $SomeTextString;

doesn't work, since exit evaluates the above scalar as an integer.  Thank you
in advance.

Dean Theophilou
Genisar


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Returning a text string

2001-12-03 Thread Bob Showalter

 -Original Message-
 From: Dean Theophilou [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 03, 2001 5:07 PM
 To: Perl_beginner (E-mail)
 Subject: Returning a text string
 
 
 Hello:
 
   I would like to exit a perl program such that upon 
 exiting, it will return a
 text string to the calling program.  How would I go about doing this?
 
 exit $SomeTextString;
 
 doesn't work, since exit evaluates the above scalar as an 
 integer.  Thank you
 in advance.

Normally this kind of thing is handled simply by writing to STDOUT
or STDERR and having the calling program set up a pipe to read
one or both of those handles.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Returning a text string

2001-12-03 Thread Brett W. McCoy

On Mon, 3 Dec 2001, Dean Theophilou wrote:

   I would like to exit a perl program such that upon exiting, it will return a
 text string to the calling program.  How would I go about doing this?

 exit $SomeTextString;

 doesn't work, since exit evaluates the above scalar as an integer.  Thank you
 in advance.

Return a text-string in what manner?  If the calling program is picking
something out of STDIN, then you will want to use die:

die Error doing something if $some_error_condition;

-- Brett
  http://www.chapelperilous.net/

Idaho state law makes it illegal for a man to give his sweetheart
a box of candy weighing less than fifty pounds.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: permanently modify a hash key?

2001-12-03 Thread John W. Krahn

Mark Hanson wrote:
 
 Hi!
 
 Yet another hash question:
 
 How can I permanently modify a hash key? I have the following hash:
 
 my %hash = (
 hygiene_products_total_amount = {
 'conditioner' = 5,
 'shampoo'   = 57,
 'soap'  = 1,
 },
 cleaning_products_total_amount = {
 'mops' = 20,
 },
 );
 
 I tried the following which prints out the correct value, but doesn't permanently 
modify the key.
 
 #removing all but two underscores
 foreach (keys %hash) {
 $count = $_ =~ s/(_)/$1/gi;
 while (($count = $_ =~ s/(_)/$1/gi)  2) {
 $_ =~ s/_//;
 }
 print \n$_\n;
 }


while ( my ( $key, $val ) = each %hash ) {
( my $newkey = $key ) =~ tr/_//d;
$hash{ $newkey } = $val;
delete $hash{ $key };
}



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Returning a text string

2001-12-03 Thread Dean Theophilou

Hi Brett:

I'm using Perl to set a password and a coworker of mine is using VB to call my
program.  The problem is that the person who will end op running the VB program
does not have access to the directory where passwords are stored.  So, I
figured, I'll use Perl to do the job, since I can easily impersonate a user with
the AdminMisc module.

  What we want is for the VB program to set a variable based on the results of
the Perl program.  Something like this (using Perl syntax):

$VBtextstring = RunPerlToGetNewPassword.exe;

Any ideas?

Dean Theophilou
Genisar


P.S.  Is that a REAL state law in Idaho?

-Original Message-
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 2:28 PM
To: Dean Theophilou
Cc: Perl_beginner (E-mail)
Subject: Re: Returning a text string


On Mon, 3 Dec 2001, Dean Theophilou wrote:

   I would like to exit a perl program such that upon exiting, it will return a
 text string to the calling program.  How would I go about doing this?

 exit $SomeTextString;

 doesn't work, since exit evaluates the above scalar as an integer.  Thank
you
 in advance.

Return a text-string in what manner?  If the calling program is picking
something out of STDIN, then you will want to use die:

die Error doing something if $some_error_condition;

-- Brett
  http://www.chapelperilous.net/

Idaho state law makes it illegal for a man to give his sweetheart
a box of candy weighing less than fifty pounds.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: system `ls` or File::Find?

2001-12-03 Thread John W. Krahn

Thomas Wright wrote:
 
 Hi folks.
 
 I need to select a single file name from a list of filenames and assign it
 to a variable.
 
 I currently do this in a few shell scripts using: $last_file=`ls -1r
 somedata_file.dat.*.orig | head -1`

If you translate this to perl it becomes:

my $last_file = (sort { $b cmp $a } somedata_file.dat.*.orig)[0];


 The * represents a timestamp in the filename. This allows me to select the
 most recent file, in this case.
 
 as an example, this would return a value such as :
 somedata_file.dat.20011203130101.orig which would be stored in $last_file
 
 When I do this in Perl thusly:
 
 $oldfile = `system ls -1r $oldfile.\*.orig | head -1`;

$oldfile = (sort { $b cmp $a } $oldfile.dat.*.orig)[0];


 Where $oldfile contains the first part of a filename passed in via
 Getopt::Long .


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




getting individual lines

2001-12-03 Thread Tyler Longren

Hello,

I have a HUGE document full of very simple SQL queries.  Each query only
takes up one line in the file.  How could I get every individual line of SQL
and execute it?  I know how to query MySQL in perl, so that's fine...I just
don't know how to get the individual lines to execute.

Thanks everyone,
Tyler



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Returning a text string

2001-12-03 Thread Brett W. McCoy

On Mon, 3 Dec 2001, Dean Theophilou wrote:

   I'm using Perl to set a password and a coworker of mine is using
 VB to call my program.  The problem is that the person who will end op
 running the VB program does not have access to the directory where
 passwords are stored.  So, I figured, I'll use Perl to do the job,
 since I can easily impersonate a user with the AdminMisc module.

 What we want is for the VB program to set a variable based on
 the results of the Perl program.  Something like this (using Perl
 syntax):

 $VBtextstring = RunPerlToGetNewPassword.exe;

Yes, again, your Visual Basic code will need to execute an external
program and capture the STDOUT and/or STDERR of the external program.  I'm
afraid I can't help you on hte VB side of things -- I don't know what
facilities it has for executing external programs.  I think your question
is more appropriate for a VB list, not a Perl list.

-- Brett
  http://www.chapelperilous.net/

Wrinkles should merely indicate where smiles have been.
-- Mark Twain


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: getting individual lines

2001-12-03 Thread Brett W. McCoy

On Mon, 3 Dec 2001, Tyler Longren wrote:

 I have a HUGE document full of very simple SQL queries.  Each query only
 takes up one line in the file.  How could I get every individual line of SQL
 and execute it?  I know how to query MySQL in perl, so that's fine...I just
 don't know how to get the individual lines to execute.

Assuming you already have a database handle called $dbh, and using DBI:

open SQLFILE, $sqlfile or die Can't open file :$1\n;

while(SQLFILE) {
  chomp;
  my $sth = $dbh-prepare($_);
  $sth-execute;
}

-- Brett
  http://www.chapelperilous.net/

You're already carrying the sphere!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Need help with workweek to week dates ...

2001-12-03 Thread rich+ml

Been a while since I had to do this... you need 'zeller congruence', an
arithmetic formula to convert date to day-of-week (circa late 1800's
IIRC). Google says 475 hits -- Rich

On Mon, 3 Dec 2001, C.E.O. wrote:

 Date: Mon, 3 Dec 2001 13:25:18 -0600
 From: C.E.O. [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Need help with workweek to week dates ...

 My company uses a custom workweek that begins
 at Midnight on Saturday and ends on Friday at 23:59:59.99.

 I need a subroutine that can take as input a workweek (12, 26, 36)
 and take as input a year (2002, 2003, 2004) all in the same
 operation. Then I need the subroutine to return values as
 custom workweek dates, like ...

 For workweek 12 of 2002, the return values would be ..

 16-MAR-2002, 17-MAR-2002, 18-MAR-2002, 19-MAR-2002, 20-MAR-2002,
 21-MAR-2002, 22-MAR-2002.

 For workweek 26 of 2003, the return values would be ..

 21-JUN-2003, 22-JUN-2003, 23-JUN-2003, 24-JUN-2003, 25-JUN-2003,
 26-JUN-2003, 27-JUN-2003.

 For workweek 36 of 2004, the return values would be ..

 28-AUG-2004, 29-AUG-2004, 30-AUG-2004, 31-AUG-2004, 1-SEP-2004,
 2-SEP-2004, 3-SEP-2004.

 I can take a yearday and get a workweek number like ..

 March 25th is the 85th day of the year, if there is no leap year that year.

 (85/7)+1 = 13.14285714

 So I know it's in workweek 13. I can take 7*.14285714 and get approximately 1.
 Assuming that Zero is Sunday, I can match up 1 with Monday and so on.

 My problem is that the custom workweek starts on Saturdays.

 Any help/code examples are really appreciated,

 ~









-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




replace char n times

2001-12-03 Thread Mark Hanson

Hi gurus!

I want to use the quantifier {COUNT}? in the following program to remove the first 
three underscores. I'm trying to avoid a loop. I have not been able to figure out the 
syntax.

$a = The_quick_brown_fox_jumped_over_the_lazy_dog.;
$count = 3;

$a =~ s/(_{$count}?)//;

print \n$a\n;

Any help is appreciated. Thanks!

/Mark



Re: replace char n times

2001-12-03 Thread Hasanuddin Tamir

On Mon, 3 Dec 2001, Mark Hanson [EMAIL PROTECTED] wrote,

 Hi gurus!
 
 I want to use the quantifier {COUNT}? in the following program to remove the first 
three underscores. I'm trying to avoid a loop. I have not been able to figure out the 
syntax.
 
 $a = The_quick_brown_fox_jumped_over_the_lazy_dog.;
 $count = 3;
 
 $a =~ s/(_{$count}?)//;
 
 print \n$a\n;

Taken from perlfaq4,

s/(_)/++$c = $count ? '' : $1/ge;


san
-- 
Trabas - http://www.trabas.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Can Perl work like Expect?

2001-12-03 Thread Ahmed Moustafa

Hi All,

I used to use Expect http://expect.nist.gov/ for dealing with 
interactive programs i.e. Telnet and FTP.

Expect lets you interact with running process as if it was a file.

Does Perl have something like that i.e. writing a Perl script which 
interacts with another process?

Your help will be appreciated so much.

Ahmed
-- 
Ahmed Moustafa
[EMAIL PROTECTED] | http://arbornet.org/~ahmed


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: replace char n times

2001-12-03 Thread Jeff 'japhy' Pinyan

On Dec 4, Hasanuddin Tamir said:

Taken from perlfaq4,

s/(_)/++$c = $count ? '' : $1/ge;

Hrm, why not:

  s/(_)/++$c  $count  $1/ge;

since it's DOCUMENTED that  returns '' for false.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




subs in while loops

2001-12-03 Thread Daniel Falkenberg

Hi All,

while(1) {
  #Read from a sub outside of the while loop...
  get_sub();
}

get_sub {
  print $test;
}

I understand that the above code doesn't really say much but it gives a
brief understading of my problem.  Baiscally when I compile the script I
get a compilation error saying...

Name main::test used only once: possible typo at ./test line (n).

Now, if I place the sub (get_sub) within the while loop my program works
fine and the error message dissapears.  Is this wise to have to do this
i.e place all my subs inside of while loops?  Is there any explanation
for this or am I just doing something completly wrong?

Regards,

Dan 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can Perl work like Expect?

2001-12-03 Thread Brett W. McCoy

On Mon, 3 Dec 2001, Ahmed Moustafa wrote:

 I used to use Expect http://expect.nist.gov/ for dealing with
 interactive programs i.e. Telnet and FTP.

 Expect lets you interact with running process as if it was a file.

 Does Perl have something like that i.e. writing a Perl script which
 interacts with another process?

 Your help will be appreciated so much.

Yep -- there's a module on CPAN called Expect.pm.  It works as you would
expect. :-)

-- Brett
  http://www.chapelperilous.net/

Violence is a sword that has no handle -- you have to hold the blade.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: subs in while loops

2001-12-03 Thread Brett W. McCoy

On Tue, 4 Dec 2001, Daniel Falkenberg wrote:

 Hi All,

 while(1) {
   #Read from a sub outside of the while loop...
   get_sub();
 }

 get_sub {
   print $test;
 }

 I understand that the above code doesn't really say much but it gives a
 brief understading of my problem.  Baiscally when I compile the script I
 get a compilation error saying...

 Name main::test used only once: possible typo at ./test line (n).

Something tells me you aren't using the -w option and don't have 'use
strict' at the top of your script, otherwise, you may have caught
something like this.

Where is $test declared and/or defined?  Inside the sub or outside?  If
you declare and/or define $test outside the sub, then you should pass it
into the sub as an argument:

my $test = 0;
while(1) {

#do stuff
get_sub($test);
}

sub get_sub {

my $test_msg = shift;
print $test_msg;
}

The basic idea, if I am following your problem, is to not use global
variables inside of subs, if you can help it.  It can lead to subtle bugs
and cause unwanted side effects.  There's nothing wrong wioth using a sub
inside a loop -- if you need to process each element of an array or a
hash, a loop is the best way to do it.

-- Brett
  http://www.chapelperilous.net/

The angry man always thinks he can do more than he can.
-- Albertano of Brescia


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can Perl work like Expect?

2001-12-03 Thread Ahmed Moustafa

Hi Brett,

Thanks a lot. Where can I find exmaples for using Expect.pm, please?

Brett W. McCoy wrote:

 On Mon, 3 Dec 2001, Ahmed Moustafa wrote:
 
 
I used to use Expect http://expect.nist.gov/ for dealing with
interactive programs i.e. Telnet and FTP.

Expect lets you interact with running process as if it was a file.

Does Perl have something like that i.e. writing a Perl script which
interacts with another process?

Your help will be appreciated so much.

 
 Yep -- there's a module on CPAN called Expect.pm.  It works as you would
 expect. :-)
 
 -- Brett
   http://www.chapelperilous.net/
 
 Violence is a sword that has no handle -- you have to hold the blade.

-- 
Ahmed Moustafa
[EMAIL PROTECTED] | http://arbornet.org/~ahmed


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




display error

2001-12-03 Thread J-E-N

below is my script but its not working as it should

system(command) or die command failed: $?\n;

what will i do so that my script will display an error once the system
command failed?


thanks :)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: display error

2001-12-03 Thread Jeff 'japhy' Pinyan

On Dec 4, J-E-N said:

below is my script but its not working as it should

system(command) or die command failed: $?\n;

system() returns 0 on SUCCESS, not failure.

  system(command) == 0 or die command failed: $! ($?);

perldoc -f system

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Problem related to page redirection in Perl.

2001-12-03 Thread D.Gupta

Hi,
I am facing the following problem. If anybody knows the answer then please let me know.
Problem Description:
When the perl script on WCS side receives a packet from the NRS then it redirects to a 
page. Depending upon whether the agent is available and wait time out is non-zero, the 
perl script again goes to listen mode. Now after receiving the new packet, the perl 
script must display the same page with the latest information about the agent. But 
this does not happen as no redirection takes place.

Thanks in advance. 
Regards,
Deepak



Re: display error

2001-12-03 Thread J-E-N

thanks for the help ...

i tried
system(/usr/bin/fetchmail -aK -f /tmp/$uid.rc)==0 or die command failed:
$!($?)\n;

but still, does not display the exit code ...

any suggestion?



 On Dec 4, J-E-N said:

 below is my script but its not working as it should
 
 system(command) or die command failed: $?\n;

 system() returns 0 on SUCCESS, not failure.

   system(command) == 0 or die command failed: $! ($?);

 perldoc -f system

 --
 Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
 RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 ** Look for Regular Expressions in Perl published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]