On Wed, 22 May 2002 06:01:14 +0100, Troy May wrote:
> A friend of mine has a task he wants to do daily, so I told him to check
> into cron but he said he doesn't have it. His server is running RedHat
> 6.1 Cartman. I've never used cron before but I'm assuming that it is
> not available to him f
On Tue, 21 May 2002 19:23:06 +0100, Barry Jones wrote:
> How can I sort a hash's keys in reverse order?
Two options would be
@keys = reverse sort keys %hash; # reverse ASCII ordering
@keys = sort { $b <=> $a } keys %hash; # reverse numeric ordering
There are many other possibilities. It reall
Slavtek wrote:
> Hello,
> I want to copy some files from one place to another. Maybe someone tell me how can I
>do this using Perl?
> Thanks in advance!
perldoc File::Copy
Loop through the files in your source directory (using glob or opendir and readdir)
and copy them.
perldoc -f glob
perldoc
Sudarsan Raghavan wrote:
> Bryan R Harris wrote:
>
> > I have a large directory tree that I'd like to build index files for,
> > essentially an
> >
> > ls > index.txt
> >
> > in each directory in the tree. Obviously I'm having trouble figuring it
> > out. =)
> >
> > I've tried the followin
Hello,
I want to copy some files from one place to another. Maybe someone tell me how can I
do this using Perl?
Thanks in advance!
--
Best regards,
Slavtek mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EM
Bryan R Harris wrote:
> I have a large directory tree that I'd like to build index files for,
> essentially an
>
> ls > index.txt
>
> in each directory in the tree. Obviously I'm having trouble figuring it
> out. =)
>
> I've tried the following:
>
> use File::Find;
> sub process_file {
> i
Hello,
A friend of mine has a task he wants to do daily, so I told him to check
into cron but he said he doesn't have it. His server is running RedHat 6.1
Cartman. I've never used cron before but I'm assuming that it is not
available to him from what he said. Is there an alternative to cron fo
On Tuesday, May 21, 2002, at 03:45 , Ovid wrote:
> --- drieux <[EMAIL PROTECTED]> wrote:
[..]
>>
>> http://www.wetware.com/drieux/pbl/perlTrick/WhatIsMeetsIsa.txt
[..]
>
> Ah, but that's the point of ref. If you have a reference, it returns the
> type of reference. If you have a simple scalar,
On Tuesday, May 21, 2002, at 04:24 , Peter Scott wrote:
[..]
> This is somewhat religious, of course,
and the rest of software development is not a matter
of studying the medieval heresy trials and resolving
which side of satan your current project is on
> and I'm not invalidating your appr
I have a large directory tree that I'd like to build index files for,
essentially an
ls > index.txt
in each directory in the tree. Obviously I'm having trouble figuring it
out. =)
I've tried the following:
use File::Find;
sub process_file {
if (-d) {
$tmp = `ls $_`;
open(OFILE, ">
Matt Simonsen wrote:
>
> I have the following code to parse the line at the bottom of the email.
> Basically I want to take the date and convert it into something easy to say
> "is this within the last _ days" - the part of this that I think is
> particularly sloppy is the whole parsing below the
Barry Jones wrote:
>
> If I have a hash full of values, and some of those values point to
> arrays of more values...in a loop, how could I distinguish which ones
> pointed to an array and which were just string values?
>
> If that doesn't make sense, here's jotted diagram:
>
> Hash
> Key 1
Jolinar Of Malkshur wrote:
>
> Ok, this still deals with that Perl class I'm taking, so be warned. And
> please don't laugh at my coding, I'm very new to Perl, so it's bound to look
> pathetic to those of you who have been doing this longer.
>
> My problem is this:
>
> I'm taking the results f
Etienne Vermaas wrote:
>
> Hi all,
Hello,
> A check to see if a pathname is "relative" or complete in some of the shell
> scripts works (seems to work)
> but I am not clear about the ?! part in the expresion, and also it seems
> that they do go together, because leaving either the ? or the ! ou
--- Matt Simonsen <[EMAIL PROTECTED]> wrote:
> I have the following code to parse the line at the bottom of the email.
> Basically I want to take the date and convert it into something easy to say
> "is this within the last _ days" - the part of this that I think is
> particularly sloppy is the
Kenny Madsen wrote:
>
> I define two arrays - one is an active changing file ( @unix = ps -ef ) and
> need to compare it to a static text file @static = `cat myfile`.
>
> Would someone help me on the syntax of greping for @static matches in the
> @unix array.
>
> For example
>
> #!/usr/bin/pe
On Tuesday 21 May 2002 17:01, Eric Beaudoin wrote:
> You can pass more than one parameter to ParseDate.
>
> my $date = ParseDate(@secureFields[0..2])
>
Doh! Yes, that's exactly what I want. I was trying @secureFields[1-3] - my
obvious (now) mistake was not using the ..
Thanks
Matt
--
To unsubs
At 19:25 2002.05.21, Matt Simonsen wrote:
>I have the following code to parse the line at the bottom of the email.
>Basically I want to take the date and convert it into something easy to say
>"is this within the last _ days" - the part of this that I think is
>particularly sloppy is the whole
My apologies to those of you who subscribe to the Topica.com Perl-NT Admins
list. You may get this message twice. I'm re-posting to this list because
lately it can take several hours for my message to show up on the topica
list.
=
ORIGINAL MESSAGE
==
At 11:21 PM 5/20/02 -0700, drieux wrote:
>b) I'm not sure I would use it in demonstration code where
>I am trying to help someone make the cross over from shell
>scripting to perl - since writing transparently readable
>code that has variables called out that say mostly what
>they are about - or t
I have the following code to parse the line at the bottom of the email.
Basically I want to take the date and convert it into something easy to say
"is this within the last _ days" - the part of this that I think is
particularly sloppy is the whole parsing below the split. Any tips (in
particu
Hi,
If anyone can help me with this, I'd be much obliged. I'm probably
missing something obvious.
I have a variable with a long line of html in it, and I need to take
certain elements from it and store them in their own variables.
I can figure out how to match the parts that I need with a regul
--- drieux <[EMAIL PROTECTED]> wrote:
>
> On Tuesday, May 21, 2002, at 12:23 , Ovid wrote:
>
> > Use the 'ref' function for this:
> >
> > perldoc -f ref
>
> my complements.
>
> why can I never remember that one
> once again thanks... I have updated
>
> http://www.wetware.com/drieux/pb
On Tuesday, May 21, 2002, at 03:12 , Timothy Johnson wrote:
> I think you are supposed to use it to connect to an SMTP server.
perlsonally I'd go with Mail::Mailer unless you really like
getting into that whole SMTP thing.
http://www.wetware.com/drieux/pbl/email/forGeorge.txt
I find that so m
> "Eric" == Eric Wang <[EMAIL PROTECTED]> writes:
Eric> newbie question: what's the equivalent of /* */ as in C++ in
Eric> PERL??
There isn't one. Some people might disagree, but hear me out. :-)
There are two ways of doing something similar, but not identical.
The first, and on
On Tuesday, May 21, 2002, at 03:13 , Eric Wang wrote:
>
>
> newbie question: what's the equivalent of /* */ as in C++ in PERL??
>
what you will see me use is
=cut
this in here is
a long running mindless comment
and I really didn't want to have
to do the whole # thing
=cut
ciao
drieux
---
I think you are supposed to use it to connect to an SMTP server. Do you
have an SMTP server running on your local machine? Otherwise you might want
to tell it to connect to one. I think there's an SMTP value that must be
set. I don't use the module myself, but I've looked at it in the past.
Hi guys,
newbie question: what's the equivalent of /* */ as in C++ in PERL??
Thanks
Eric
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I tried sendmail and it says connect to localhost failed. Help please
Eric
On Tue, 21 May 2002, Timothy Johnson wrote:
>
> You can also use Mail::Sendmail or Mail::Sender to send emails from a perl
> script. Both should be on CPAN.
>
> -Original Message-
> From: Tim Musson
> To: [EMAI
On Tuesday, May 21, 2002, at 12:23 , Ovid wrote:
> Use the 'ref' function for this:
>
> perldoc -f ref
my complements.
why can I never remember that one
once again thanks... I have updated
http://www.wetware.com/drieux/pbl/perlTrick/WhatIsMeetsIsa.txt
and I think I have a possible so
On Tuesday, May 21, 2002, at 12:17 , Barry Jones wrote:
> If I have a hash full of values, and some of those values point to
> arrays of more values...in a loop, how could I distinguish which ones
> pointed to an array and which were just string values?
eg:
while ( my ( $key , $val ) =
D'oh! You're right.
-Original Message-
From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 11:37 AM
To: 'Barry Jones'; [EMAIL PROTECTED]
Subject: RE: Reverse sort?
To expand on that, the "<=>" operator is for numeric comparisons and "cmp"
are for string compari
> My problem is this:
>
> I'm taking the results from a hash search (that determines if a particular
> student name and password combination is valid) and passing it to another
> hash search (which is part of an if loop), which is supposed to print out
> the assignments for the student. That wor
--- Barry Jones <[EMAIL PROTECTED]> wrote:
> If I have a hash full of values, and some of those values point to
> arrays of more values...in a loop, how could I distinguish which ones
> pointed to an array and which were just string values?
Barry,
Use the 'ref' function for this:
perldoc -f
If I have a hash full of values, and some of those values point to
arrays of more values...in a loop, how could I distinguish which ones
pointed to an array and which were just string values?
If that doesn't make sense, here's jotted diagram:
Hash
Key 1 => Value
Key 2 => Value
Key
Ok, this still deals with that Perl class I'm taking, so be warned. And
please don't laugh at my coding, I'm very new to Perl, so it's bound to look
pathetic to those of you who have been doing this longer.
My problem is this:
I'm taking the results from a hash search (that determines if a part
My apologies,
I miscopied the code, it should have been:
foreach (reverse sort keys %myhash) {
print "$_ : $myhash{$_}\n";
}
-Original Message-
From: Mark Anderson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 11:38 AM
To: [EMAIL PROTECTED]
Subject: RE: Reverse sort?
Thanks. I ended up using
reverse sort keys %hash;
-Original Message-
From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 2:37 PM
To: Barry Jones; [EMAIL PROTECTED]
Subject: RE: Reverse sort?
To expand on that, the "<=>" operator is for numeric comparisons and
Hi -
Try ...
use strict;
use warnings;
my %hash = (a => 1, b => 2, c => 3,);
# use the reverse keyword
print "$_\n" for (reverse sort keys %hash);
# reverse $a and $b
print "$_\n" for (sort { $b cmp $a } keys %hash);
Aloha => Beau.
-Original Message-
From: Barry Jones [m
More readable/maintainable is:
@items = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
@sortedItems = reverse sort @items; #reverse sort the array
print "@sortedItems";
Which gives the following as the answer:
foreach reverse sort keys %myhash {
print "$_ : $myhash{$_}\n";
}
To expand on that, the "<=>" operator is for numeric comparisons and "cmp"
are for string comparisons... make sure you use the right one.
This may also work for what you need...
@items = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
@sortedItems = reverse( sort(@items) );
Rob
-O
You can do it like this:
@items = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
@sortedItems = sort{$b <=> $a}@items; #reverse the sort
print "@sortedItems";
When you use the <=> operator, you can specify the direction by where you
put the $a and $b variables.
-Original Message-
How can I sort a hash's keys in reverse order?
Barry Jones
DATABUILT, Inc. The Global AEC Information Company
1476 Fording Island Rd. Bluffton, SC 29910
(843) 836-2166 office
"Life is like a dogsled team;
if you ain't the lead dog, the scenery never changes."
- Lewis Grizzard
--
To unsubscribe
>>From: Bob Showalter
>> From: Postman Pat
>>
>> Greetings,
>> I am trying to do command line processing using the above
>> lib, but am not
>> quite getting the syntax from the PLEAC perl project. For
>> instance I have
>> the following args allowed:
>> -s x.x.x.x | server.domain.com > serv
On Tuesday, May 21, 2002, at 06:16 , Tor Hildrum wrote:
> You can use the $ARGV[X] values directly like above, or you can put them
> in
> variables. I guess that's what drieux did. Everything passed from the
> command line are put into to the @ARGV array.
> So, when I write
> % ./argv.pl 2 3 ba
> Could anyone point me to a good tutorial on how to do this or give me some
> simple examples. I have read some of what is in Advanced Perl programming
> book. But unfortunately I am pretty new to perl and I don't know jack about
> C.
perldoc perlembed - contains some simple examples... for ce
The (?! regex) is called a zero-width negative look-ahead assertion
which in this case says if the first character of the search is NOT a / then
you have a relative directory name. With this type of test, there is no
association of a hit to $1, $2, etc.
You could just as easily do
Or embedding perl in a C program.
Could anyone point me to a good tutorial on how to do this or give me some
simple examples. I have read some of what is in Advanced Perl programming
book. But unfortunately I am pretty new to perl and I don't know jack about
C.
Basically all I want to do is ca
Hi all,
A check to see if a pathname is "relative" or complete in some of the shell
scripts works (seems to work)
but I am not clear about the ?! part in the expresion, and also it seems
that they do go together, because leaving either the ? or the ! out screw up
the results.
I'll appreciat yo
on Tue, 21 May 2002 15:17:38 GMT, [EMAIL PROTECTED] (Kenny
Madsen) wrote:
> I define two arrays - one is an active changing file ( @unix = ps
> -ef ) and need to compare it to a static text file @static = `cat
> myfile`.
>
> Would someone help me on the syntax of greping for @static matches
On Mon, May 20, 2002 at 08:54:19PM -0700, [EMAIL PROTECTED] wrote:
> Hi,
>
> I try to write a script that redirects its output, both out and error, to
> a log-file, if it's possible to the screen as well.
>
> At the moment I'm doing this with
>
> open (FILE, ">whatever.txt");
>
> open (STDOUT
> I define two arrays - one is an active changing file ( @unix = ps -ef ) and
> need to compare it to a static text file @static = `cat myfile`.
>
> Would someone help me on the syntax of greping for @static matches in the
> @unix array.
> I am not sure if I need to assign a variable, for loo
You can also use Mail::Sendmail or Mail::Sender to send emails from a perl
script. Both should be on CPAN.
-Original Message-
From: Tim Musson
To: [EMAIL PROTECTED]
Sent: 5/21/02 4:31 AM
Subject: Re: win32 mail
Hey Arran4,
nope, no send mail client in the default install of Win.
I u
I define two arrays - one is an active changing file ( @unix = ps -ef ) and
need to compare it to a static text file @static = `cat myfile`.
Would someone help me on the syntax of greping for @static matches in the
@unix array.
For example
#!/usr/bin/perl -w;
use strict;
my @unix = `ps
On Tue, 21 May 2002 15:17:03 +0100, Barry Jones wrote:
> Yes but you have to write it like this:
>
> (@main) = (@data1,@data2,@data3);
No you don't.
@main = (@data1,@data2,@data3);
works just fine.
Dave...
--
Shoot some of those missiles, think of us as fatherless scum
It won't be for
Drieux wrote:
> foreach my $file (@ARGV) { # for everything we see on the command line
> # let us assume it is a file for simplicity
> if ( -f $file ) {
> open(FH, "$file"); # normally we want to die
> print $_ while(); # silly but a one liner
> # could have been while() { print $_ ;}
> # but tha
Greetings,
I am trying to do command line processing using the above lib, but am not
quite getting the syntax from the PLEAC perl project. For instance I have
the following args allowed:
-s x.x.x.x | server.domain.com > server is ip/host
-o outfile > output to outfile
-h > display help.
I under
Hi, all --
I have a heterogeneous perl installation requirement and I'm just pulling
my hair out. I've had trouble ./Configure-ing and compiling under HP-UX
and my @INC doesn't seem to be right under Solaris.
I have a perl structure about like
$TOP/
perl/
5.6.1/
SunOS/
Here's how you can do it (this is just one way):
#!/usr/bin/perl
@x = ('a','b');
@y = ('c','d');
@z = ('e','f');
@xyz = (@x,@y,@z);
print @xyz;
Output is : abcdef
Got it!!!
Aman
- Original Message -
From: "A Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 21,
Yes but you have to write it like this:
(@main) = (@data1,@data2,@data3);
-Original Message-
From: A Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 10:05 AM
To: [EMAIL PROTECTED]
Subject: simple array question
Hi all,
I have a very simple and probably stupid question to
Sure.
@main = (@data1, @data2, @data3);
Rob
-Original Message-
From: A Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 10:05 AM
To: [EMAIL PROTECTED]
Subject: simple array question
Hi all,
I have a very simple and probably stupid question to ask.
If I have a set of array
Hi all,
I have a very simple and probably stupid question to ask.
If I have a set of arrays, @data1, @data2, @data3 etc, can I join them all
together to make 1 main array ie: @main = @data1 + @data2 + @data3;
Thanks in advance
Anadi
_
Hi, I wanted to delete some entries in The NT EventLog in the category
Application:
I have this code:
use Win32::EventLog;
use GetMyRegPath;
my $CMPath = GetMyRegPath::GetCygwinMountsPath();
use Time::CTime;
my ($Event, @timearray, $filename,
$day, $month, $directory);
# Where do you want
Okay thanks, I added "my $dbh;" prior to the subroutine and am still
receiving the same error. Here is the code:
#!/usr/local/bin/perl
#
$ENV{'ORACLE_HOME'} = '/apps/oracle/product/8.1.7';
$ENV{'NLS_LANG'}= 'AMERICAN_AMERICA.WE8ISO8859P1';
$ENV{'NLS_DATE_FORMAT'} = 'DD-MON-RR';
#$g
> From: "Taylor Lewick" <[EMAIL PROTECTED]>
> Date: Tue, 21 May 2002 08:00:45 -0500
> To: <[EMAIL PROTECTED]>
> Subject: avoid backticking if at all possible - Re: perl awk question
>
> Thanks drieux, I looked over the code you posted, most of it makes sense, but
> am still a little confused over
Hi,
Thanks for the message. I was infact able to rectify the problem. Many
thanks for the assistance.
Regards,
ankit
"Drieux" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On Monday, May 20, 2002, at 03:53 , Ankit Gupta wrote:
>
> > I am working using Mbox
on Tue, 21 May 2002 13:06:41 GMT, [EMAIL PROTECTED] (Felix
Geerinckx) wrote:
> [Private message returned back to list]
My apologies - this should have gone to [EMAIL PROTECTED] instead of
[EMAIL PROTECTED]
--
felix
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mai
[Private message returned back to list]
Please send further questions to the mailing list instead of by private
email. Other list members may want to contribute.
>
>
>The query does work in Sql*plus. I'm not getting any errors from my
>connect string. Here is the sub with my dbh definition:
Thanks drieux, I looked over the code you posted, most of it makes sense, but am still
a little confused over a couple of things,
Why are you setting $infile and $outfile to ARGV values? I thought those were being
past from the command line, but in this instance, I know what files I want to acc
ikonboard
-Original Message-
From: Michael Norris [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 4:50 AM
To: [EMAIL PROTECTED]
Subject: Perl Bulletin Boards
VBulletin seems to be a favorite bulletin board among PHP folks. Are there
any good perl alternatives out there. Well,
VBulletin seems to be a favorite bulletin board among PHP folks. Are there any good
perl alternatives out there. Well, let me reprhase that because I know there are Perl
alternatives. Those can easily be found. I should say, is there a Perl favorite out
there that is comparabe to the nice l
on Sat, 18 May 2002 14:53:30 GMT, [EMAIL PROTECTED] (Beau E. Cox) wrote:
> No, really - I showed you mine, now you show me yours!
#! /usr/bin/perl -w
use strict;
sub generator {
my $lref = shift;
my $minseq = shift;
my $nextfun = shift;
my $curpos = 0;
my $lastpos = scalar(@$lref)-
Hey Arran4,
nope, no send mail client in the default install of Win.
I usually use something I grabbed from TPJ
use Net::SMTP;
my($mh, $MailTo, $Subject, $MessageBody);
#don't forget to set each of the above!
sub sendMail {
my $smtp = Net::SMTP->new("$mh");
$smtp->mail($MailTo); # en
Use waitVariable method of widget
$widget->waitVariable(\$var);
To have a program wait until a variable is set, call waitVariable. The
value of $var must be undefined before u call waitVariable and
processing will resume as soon as $var is defined..
U can define $var when the first routine fini
on Mon, 20 May 2002 12:25:26 GMT, [EMAIL PROTECTED]
(Arran4) wrote:
> heh thats has already been added to my ever growing signuture
> hehehe (should shorten it sometimes)
I don't think this is funny. Your 'signature' is 24 lines long now, and
contains over 1000 bytes. According to , the beginn
on Mon, 20 May 2002 20:39:54 GMT, [EMAIL PROTECTED] (Shaunn Johnson)
wrote:
> I think I need a second pair of eyes.
> #!/usr/bin/perl -w
> use diagnostics;
> use CGI;
> use GD::Graph::lines;
> use DBI;
It wouldn't hurt adding
use strict;
here. You will have to declare a lot o
[EMAIL PROTECTED] (Beau E. Cox) writes:
> Gee whiz - All I wanted were comments on the book...
> Has anyone out there read it?
Yes, of course. It's great. One thing I really liked about it when I
read it[1] was that it's short usable snippets. Read it before
falling asleep, or in the bathroom
Does "select" support big FDS (File Descriptor). This means can we use
handle larger than 2056 with select.
For example:
vec($rin,0,65536) = 1;
select($rin, undef, undef, undef);
Thanks,
Vincent
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTE
78 matches
Mail list logo