RE: Book on Perl!

2002-09-10 Thread Dave Cross
On Sat, 07 Sep 2002 09:27:48 +0100, Daniel Schwedler Kofoed wrote: > Hi, > > Learning Perl is a good and easy one - here is a link to some of the > perl books: [ removed ] You might want to reconsider whether it's a good idea advertising a site where illegal copies of books are distributed. Pa

Re: Cron alternatives?

2002-05-21 Thread Dave Cross
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

Re: Reverse sort?

2002-05-21 Thread Dave Cross
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

RE: simple array question

2002-05-21 Thread Dave Cross
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

Re: Yesterday's date

2002-04-08 Thread Dave Cross
On Mon, 08 Apr 2002 02:04:10 +0100, Troy May wrote: > What's the easiest way to get yesterday's date from localtime? I need > it in this format: (for today) "070402". > > Here is the code used for today's date: > > ($sec,$min,$hour,$mday,$mon,$year,undef,undef,undef) = localtime(); > $mon++;

Re: Book suggestion

2002-03-03 Thread Dave Cross
5.uwinnipeg.ca/CPAN/perl/pod/perlfaq2/Perl_Books.html > > Though that book isn't mentioned specifically, I recall that Dave Cross > helped to improve the book immensely and is a good book from what I've > heard. No. The book I worked on was "Perl and CGI for the World Wide We

RE: Dates in file or directory names ?

2002-02-18 Thread Dave Cross
On Sat, 02 Feb 2002 17:11:12 +, Timothy Johnson wrote: > -Original Message- > > From: Dave Cross > > To: [EMAIL PROTECTED] > > Sent: 2/2/02 1:01 AM > > Subject: Re: Dates in file or directory names ? > > > > On Thu, 31 Jan 2002 21:20:16 +

Re: Dates in file or directory names ?

2002-02-02 Thread Dave Cross
On Thu, 31 Jan 2002 21:20:16 +, Mark Richmond wrote: > Ok, so I'm confused > What I want to do is create a directory where the name is the current > date say mkdir(2002131) > What Can't figure out is how to build the date string. I'm sure I'm > just missing something. > Any thoughts. [can yo

Re: $hash{$_}++

2001-06-18 Thread Dave Cross
On Mon, Jun 18, 2001 at 05:34:29PM -0400, David Gilden ([EMAIL PROTECTED]) wrote: > How about a an example or 2 where you would use this, > > $hash{$_}++ # count the occurences of values in an array my %hash; $hash{$_}++ foreach @array; # and display the results sorted print map { "$_: $hash{

Re: Update: Where to begin??!!??

2001-06-15 Thread Dave Cross
On Fri, Jun 15, 2001 at 01:45:00PM -0700, Peter Cornelius ([EMAIL PROTECTED]) wrote: > > > > open (FILE_IN, "pslbingocard.dat")|| die "failed to open file\n"; > You really want an 'or' here ---^^ not '||'. The operator precedence > can bite you. Only if you miss out the parenthesis around

Re: Update: Where to begin??!!??

2001-06-15 Thread Dave Cross
On Fri, Jun 15, 2001 at 04:43:26PM -0400, Michael Wolfrom ([EMAIL PROTECTED]) wrote: > > Dave Cross wrote: > > > > > > #! usr/bin/perl > > > use strict; > > > > > > open (FILE_IN, "pslbingocard.dat")|| die "failed to open file

Re: Update: Where to begin??!!??

2001-06-15 Thread Dave Cross
On Fri, Jun 15, 2001 at 01:33:30PM -0700, Greg Meckes ([EMAIL PROTECTED]) wrote: > First : > Your assigning a newline to the "$/" scalar: $/ = "\n"; > Why? Get rid of it. > > Second: > The split: split (/|/, $/); > Should be : split (/\|/, $_); > > Third: > You should escape the pipes in the pri

Re: Update: Where to begin??!!??

2001-06-15 Thread Dave Cross
On Fri, Jun 15, 2001 at 01:37:51PM -0700, Crystal Gruetzmacher ([EMAIL PROTECTED]) wrote: > what is $_ for? It's the "default" variable an is used for a great many things in Perl. In this case, it's where each line of a file ends up when you use the construction: while () { # each line of f

Re: Update: Where to begin??!!??

2001-06-15 Thread Dave Cross
Crystal, Some comments interspersed with your code below. On Fri, Jun 15, 2001 at 01:25:59PM -0700, Crystal Gruetzmacher ([EMAIL PROTECTED]) wrote: > I'm trying, really I am, but I can't get this thing to work (yet). Here's > what I have so far. Am I missing something crucial that doesn't give

Re: Beginer...Any free resources for Learning Perl

2001-06-14 Thread Dave Cross
On Wed, Jun 13, 2001 at 07:12:45PM +0200, Evgeny Goldin (aka Genie) ([EMAIL PROTECTED]) wrote: > > Check up my catalog at : > [url removed] > > It's only a catalog but I upload titles from it upon request. He does, indeed, happily distribute pirate copies of Perl (and other) books to anyone wh

Re: reading the next line from a file

2001-06-13 Thread Dave Cross
On Wed, Jun 13, 2001 at 02:45:40PM -0400, Brett W. McCoy ([EMAIL PROTECTED]) wrote: > On Wed, 13 Jun 2001, Esrar Chowdhury wrote: > > > my question is...how do I make the read pointer read every 10th line > > from my input file? (After reading one line, does the read pointer stay > > on the same

Re: reading the next line from a file

2001-06-13 Thread Dave Cross
On Wed, Jun 13, 2001 at 01:30:07PM -0700, Esrar Chowdhury ([EMAIL PROTECTED]) wrote: > Hi! > > I just started using perl and have a question. Let say I have an inputfile > with 100 lines. Each of these lines contain a name...first name and > last name. > > I need to be able to read the 1st name.

Re: extracting substr

2001-06-11 Thread Dave Cross
On Sat, Jun 09, 2001 at 06:33:21PM -0500, Karen Cravens ([EMAIL PROTECTED]) wrote: > On 9 Jun 2001, at 16:21, William wrote: > > >if (($L) = ($_) =~ m/\b([0-9.0-9.0-9.0-9]+)\b/ ) { > > A valid IP address is going to look like four groups of one to three > digits separated by dots. > > So i