Re: sort arrays by size

2002-07-07 Thread John W. Krahn
Patricia Hinman wrote: > > Does anyone know of a routine that will sort arrays by > size. I need to sort any number of given arrays, and > operate on the largest to the smallest. > > I've just recently learned of the > @nums = sort{$a<=>$b} @numbers; > > hope the answer for arrays is as simple

Re: real beginner's question

2002-07-07 Thread John W. Krahn
David Carpenter wrote: > > This is a list for beginners, right? So perhaps no one will be too annoyed > if I ask what is probably a really stupid question . . . > > I have a text file with occasional strings enclosed in braces: > kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . . > > I would

Re: real beginner's question

2002-07-07 Thread bob ackerman
On Sunday, July 7, 2002, at 10:03 PM, bob ackerman wrote: > > On Monday, July 8, 2002, at 12:55 AM, Todd Wade wrote: > >> >> "David Carpenter" <[EMAIL PROTECTED]> wrote in message >> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> >>> I have a text file with occasional strings enclosed in brac

Re: sort arrays by size

2002-07-07 Thread Todd Wade
"Bob Ackerman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > On Monday, July 8, 2002, at 12:46 AM, Todd Wade wrote: > > > > > "Patricia Hinman" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Does anyone know of a

Re: real beginner's question

2002-07-07 Thread bob ackerman
On Monday, July 8, 2002, at 12:55 AM, Todd Wade wrote: > > "David Carpenter" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> I have a text file with occasional strings enclosed in braces: >> kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . . >> >> I wou

Re: sort arrays by size

2002-07-07 Thread bob ackerman
On Monday, July 8, 2002, at 12:46 AM, Todd Wade wrote: > > "Patricia Hinman" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> Does anyone know of a routine that will sort arrays by >> size. I need to sort any number of given arrays, and >> operate on the l

Re: real beginner's question

2002-07-07 Thread Todd Wade
"David Carpenter" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a text file with occasional strings enclosed in braces: > kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . . > > I would like to use tr/// to modify the characters within the braces, whi

RE: sort arrays by size

2002-07-07 Thread Toby Stuart
Hi Patricia, Whilst this does not answer your question in full it should act as a starting point. @array = qw(1 2 3 4); # four elements print $#array+1; # will print 4 HTH Toby "Patricia Hinman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Does anyone kn

Re: sort arrays by size

2002-07-07 Thread Todd Wade
"Patricia Hinman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Does anyone know of a routine that will sort arrays by > size. I need to sort any number of given arrays, and > operate on the largest to the smallest. > > I've just recently learned of the > @n

Re: New Script

2002-07-07 Thread Todd Wade
"Janek Schleicher" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Todd Wade wrote at Sat, 06 Jul 2002 21:25:24 +0200: > > > > > I might use something like this: > > > > #!/usr/bin/perl -w > > I would be too lazy to write my own random_string subroutine. >

sort arrays by size

2002-07-07 Thread Patricia Hinman
Does anyone know of a routine that will sort arrays by size. I need to sort any number of given arrays, and operate on the largest to the smallest. I've just recently learned of the @nums = sort{$a<=>$b} @numbers; hope the answer for arrays is as simple. Thanks Tricia [EMAIL PROTECTED] _

RE: real beginner's question

2002-07-07 Thread John Almberg
This does sound like an ideal job for Perl, but I think you need to give us more info on what you want to do. For instance, translate all 'i's inside the braces to 'x's, or substitute one sequence of characters for another. An example or scenario would be helpful here. -- John # -Original Me

real beginner's question

2002-07-07 Thread David Carpenter
This is a list for beginners, right? So perhaps no one will be too annoyed if I ask what is probably a really stupid question . . . I have a text file with occasional strings enclosed in braces: kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . . I would like to use tr/// to modify the characte

Re: Search Engines in Perl

2002-07-07 Thread John W. Krahn
Vargas Media wrote: > > Hi All, Hello, > I am new to Perl and I have been grabbing code here and there to make a > search engine for a site. - Posted below. > What I have works but is incredibly slow and doesn't report back when a > match is not found. > I have been working with "CGI Programmin

Re: extract info from file name

2002-07-07 Thread Jenda Krynicky
From: Kevin Pfeiffer <[EMAIL PROTECTED]> > > my $test = "Rnott230602.txt"; > > if ( $test =~ m/^(.{1})(.{4})(.{6})\.(.{3})$/ ) { > > What is the difference between "if ( $test =~ m/...)" > and "if ( $test =~ /...)" (without the "m")? (If any?) None. The "m" just allows you to use a different d

Re: cookies2

2002-07-07 Thread Jenda Krynicky
From: "Mariusz" <[EMAIL PROTECTED]> > Can I set it and then check if it was created within the same script? > M > > > You just set one on one page and test whether it's set on the next > > one. No. You need to send a page to the client with the cookie "attached" and see if it's sent by the cl

Re: cookies2

2002-07-07 Thread Mariusz
Can I set it and then check if it was created within the same script? M > You just set one on one page and test whether it's set on the next > one. > > Jenda > === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == > There is a reason for living. There must be. I've seen it somewh

Re: extract info from file name

2002-07-07 Thread Kevin Pfeiffer
Hi from an (until now) silent list reader, Nigel Peck writes: > I probably should have explained what this is doing, the match m// takes > the string in $test and (using the parenthesis for capturing), puts the > first character in $1, the second 4 characters in $2... [...] Such explanations are

Re: How to change "20020706" to "July 6, 2002"?

2002-07-07 Thread chris
Nice. Short and sweet. I am still into a strong type approach for variables rather than let Perl fill in the blanks. On Sun, 7 Jul 2002 16:33:56 +0800, [EMAIL PROTECTED] (Connie Chan) wrote: >How about this ? > >my $in = 20020706; >my @months = ('', Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, O

Search Engines in Perl

2002-07-07 Thread Vargas Media
Hi All, I am new to Perl and I have been grabbing code here and there to make a search engine for a site. - Posted below. What I have works but is incredibly slow and doesn't report back when a match is not found. I have been working with "CGI Programming with Perl" from O'Rielly but, haven't had

Re: changing %ENV in parent

2002-07-07 Thread Peter Scott
At 09:33 AM 7/6/02 -0500, David T-G wrote: >I want to add to $ENV{'PATH'} in the parent process from my script. >Generally I know this isn't allowed, but I wonder if there's a way to do >it. No. It's a Unix FAQ and Perl can't do it any more than any other language. See 2.8 in http://www.faqs.o

Re: help with globals and if

2002-07-07 Thread David T-G
Bob, et al -- ...and then bob ackerman said... % % On Sunday, July 7, 2002, at 05:47 AM, David T-G wrote: % ... % > # $_[0] =~ /tcsh/ && $setenv = "setenv" ; % > # $_[0] =~ /tcsh/ && { $setenv = "setenv" ; } ; % > # $_[0] =~ /tcsh/ && { $setenv = 'setenv' ; } ; % > # if $_[0] =~ /tcsh/

Re: executables

2002-07-07 Thread Jenda Krynicky
From: PayalR <[EMAIL PROTECTED]> > I am quite new to perl. I heard that there is an application, which > converts perl programs into binary executables one. Can any one tell > me about those kind of programs? I would like to have a full working > freeware program. Thanks a lot in advance and waiti

Re: cookies

2002-07-07 Thread Jenda Krynicky
> Is there a way to check if the person accepts cookies? > > thanks. > M You just set one on one page and test whether it's set on the next one. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's

Re: help with globals and if

2002-07-07 Thread bob ackerman
On Sunday, July 7, 2002, at 05:47 AM, David T-G wrote: > Hi, all -- > > It must still be early, because I just don't get this. > > Given the snippet > > sub setpath(my $shelltype) > { > my ($setenv,$equals) ; > # $_[0] =~ /tcsh/ && $setenv = "setenv" ; > # $_[0] =~ /tcsh/ && { $se

help with globals and if

2002-07-07 Thread David T-G
Hi, all -- It must still be early, because I just don't get this. Given the snippet sub setpath(my $shelltype) { my ($setenv,$equals) ; # $_[0] =~ /tcsh/ && $setenv = "setenv" ; # $_[0] =~ /tcsh/ && { $setenv = "setenv" ; } ; # $_[0] =~ /tcsh/ && { $setenv = 'setenv' ; } ; #

Re: number 1 showing up in printf output I don't understand

2002-07-07 Thread Connie Chan
I don't know, I guess 1 is a return of "true" signal. However, for your purpose, use sprintf will solve your problem. Rgds, Connie - Original Message - From: "Zachary Buckholz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, July 07, 2002 2:19 PM Subject: number 1 showing up in

Re: number 1 showing up in printf output I don't understand

2002-07-07 Thread Robert Kasunic
Hello Zachary, On Sat, Jul 06, 2002 at 11:19:58PM -0700, Zachary Buckholz wrote: > Odd extra '1' showing up? Can someone explain this. > my $current_date = printf("%04d-%02d-%02d", $year+1900, $month+1, $day); ^^ The problem lies here. You have to use sprintf to get a

number 1 showing up in printf output I don't understand

2002-07-07 Thread Zachary Buckholz
Odd extra '1' showing up? Can someone explain this. #!/usr/local/bin/perl -w my $current_date = getdate(); print "$current_date\n"; exit(); sub getdate { my ($day, $month, $year) = (localtime)[3,4,5]; my $current_date = printf("%04d-%02d-%02d", $year+1900, $month+1, $day); return($current_d

Re: How to change "20020706" to "July 6, 2002"?

2002-07-07 Thread Connie Chan
How about this ? my $in = 20020706; my @months = ('', Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); my $out = "$months[$2] $3, $1" if ( $in =~ /(\d{4})(\d{2})(\d{2})/); Rgds, Connie - Original Message - From: "John W. Krahn" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>