Re: Copy a portion of a file to a new file?

2002-01-29 Thread Ahmed Moustafa
Hi Bill, You can use "last"; i.e.: #Code beings open (IN, "out.txt") || die; while () { last if /END/; print OUT; } close (IN); close (OUT); #Code ends I hope that helps. Bill Akins wrote: > Hi all, > > I would like to read in a file and print out to a new file UNTIL I reach a > key word in

Re: return @hash_table{ @extract };

2002-01-29 Thread Jeff Bisbee
* [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > >> > > # foreach $number (qw ) { > > foreach $number ($extract) { > > push (@return_array, $hash_table{$number}); > > } > > return @return_array; > > return @hash_table{ @extract }; > > This will return a list of values from %hash_

Reading text

2002-01-29 Thread Michael Pratt
What is the simplest means of reading a text file line by line. Thanks! Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Capturing Session values?

2002-01-29 Thread Mark Weisman
I'd like to be able to capture some remote information when a user logs into and uses a CGI script, but I'm not sure I understand how? I can do it using an echo and cat as in: >>#!/usr/local/sh >>Echo REMOTE_ADDR = $REMOTE_ADDR >>Cat But what I can't do is put that with in a standard perl scrip

how to pass an object as an argument in a subroutine?

2002-01-29 Thread Ambrosius27
Hi, I've hit a wall in passing an object as an argument in a subroutine (well, an object method). The method/subroutine recognizes that the passed object is a reference, but it doesn't recognize it as a blessed reference. Does anyone know how to do that? Here's a more detailed look at what

Re: newbie question

2002-01-29 Thread John
While you're at it: make love cat food At Tuesday, 29 January 2002, "Clarke" <[EMAIL PROTECTED]> wrote: >$ man make > >;-) > >Clarke > >- Original Message - >From: Thunem, Tom <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Tuesday, January 29, 2002 5:45 PM >Subject: newbie question

Re: Perl path for windows 98

2002-01-29 Thread John
It may be convenient to set the PATHEXT environment variable to include ..pl, that way it should search your PATH for .pl files (so you don't have to type the path or be in the directory). At least this works in 2000, don't know 98. At Tuesday, 29 January 2002, "Angus Laycock" wrote: >Hi, >

sorting with each

2002-01-29 Thread John
I heard each was more efficient than what appears here. Is there any way to get each to sort? foreach my $key ( sort( keys( %somehash ))) { print "$key = $somehash{$key}\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

dynamic array values

2002-01-29 Thread Scott Lutz
Here is the story: "@array" with unknown number of elements, that I want to cycle through while assigning variables to each value in the loop like this: __snip__ foreach my $domain ( @DOMAINS_ORDERED ){ (my $DOM_NAME, my $TLD) = split(/\./, $domain, 2); #split the domain into 2, so we ca

Matching text.. Question

2002-01-29 Thread Lorne Easton
The following code: SNIP sub return_internal_links { foreach my $element (@links) { my $all_internal = join("\n",@internal),"\n"; if (($element =~ m/$startingurl/i) && ($all_internal !~ m/$element/gi)) { print $element,"\n"; push (@internal, $element); } } }

RE: Matching text, e.t.c.

2002-01-29 Thread Lorne Easton
The following code: SNIP sub return_internal_links { foreach my $element (@links) { my $all_internal = join("\n",@internal),"\n"; if (($element =~ m/$startingurl/i) && ($all_internal !~ m/$element/gi)) { print $element,"\n"; push (@internal, $element); } } }

Re: simple file question

2002-01-29 Thread Deen Hameed
while ( ) { push(@new_names, $_) unless ($_ eq $myvar); } # now you have a list of new names you can append to the file open(FILEHANDLE, ">>somefile.txt"); print FILEHANDLE join("\n", @new_names); close FILEHANDLE; deen On Wed, 30 Jan 2002, Chris Zampese wrote: > Hello eve

Copy a portion of a file to a new file?

2002-01-29 Thread Bill Akins
Hi all, I would like to read in a file and print out to a new file UNTIL I reach a key word in the file. I tried something like while (<>) { if !/KEYWORD/; print $ >> dest.txt; } but that seems to copy all lines of the file except the one(s) contining KEYWORD. How can I have this exit and clo

return @hash_table{ @extract };

2002-01-29 Thread Murzc
>> > # foreach $number (qw ) { > foreach $number ($extract) { > push (@return_array, $hash_table{$number}); > } > return @return_array; return @hash_table{ @extract }; This will return a list of values from %hash_table using the keys from @extract. Please explain why this wo

Re: newbie question

2002-01-29 Thread jbajin
- Original Message - From: "Clarke" <[EMAIL PROTECTED]> > $ man make >What is the meaning of the dollar sign. I am using windowsME. That was his Unix prompt. You won't be able to do a man on make in Windows. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: newbie question

2002-01-29 Thread Leon
- Original Message - From: "Clarke" <[EMAIL PROTECTED]> > $ man make What is the meaning of the dollar sign. I am using windowsME. Thanks. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To

Re: simple file question

2002-01-29 Thread Tanton Gibbs
BTW, I forgot a chomp... while( ) { chomp; ... same as before... } - Original Message - From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: "Chris Zampese" <[EMAIL PROTECTED]>; "perl list" <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 9:22 PM Subject: Re: simple file question >

Re: simple file question

2002-01-29 Thread John W. Krahn
Chris Zampese wrote: > > Hello everyone, Hello, >I have a variable $myvar (an email address), and > I would like to open a simple text file which contains > email addresses (one on each line) and check to see if > the address in $myvar is in there, if it is not, then > append it o the end o

RE: simple file question

2002-01-29 Thread McDonald Patrick
Write your print statement like this if /$email2/o { print FILE2; } -Original Message- From: Chris Zampese [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 9:18 PM To: perl list Subject: Re: simple file question Just found a regex in the docs. I now have this... while

Re: simple file question

2002-01-29 Thread Tanton Gibbs
You can use the following open INF, "filename.txt" or die "Could not open file: $!\n"; my $myvar = <>; # get email address from stdin my $found = 0; while( ) { if( $myvar eq $_ ) { $found = 1; last; } } close(INF); if( !$found ) { open OUTF, ">>filename.txt" or die "Could not o

RE: Text wrapping

2002-01-29 Thread David Blevins
Thanks, Looks like I finally have to go beyond chapter 2 in Programming Perl :) Chapter 11, here I come. (not a reference to bankruptcy) Thanks again, David > -Original Message- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 29, 2002 7:59 PM > To: David

Re: simple file question

2002-01-29 Thread Chris Zampese
Just found a regex in the docs. I now have this... while () { print if /$email2/o; } but I am still not sure how to print to the file?? - Original Message - From: "Chris Zampese" <[EMAIL PROTECTED]> To: "perl list" <[EMAIL PROTECTED]> Sent: Wednesday, January 30, 2002 3:

simple file question

2002-01-29 Thread Chris Zampese
Hello everyone, I have a variable $myvar (an email address), and I would like to open a simple text file which contains email addresses (one on each line) and check to see if the address in $myvar is in there, if it is not, then append it o the end of the file, and if it is, then close the f

Re: Text wrapping

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, David Blevins said: >What's the best way to approach text wrapping? Have you considered the Text::Wrap module? Or perhaps Text::AutoFormat? -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://w

Text wrapping

2002-01-29 Thread David Blevins
What's the best way to approach text wrapping? I have a line in the email that isn't wrapped. There must be a simpler way to do this other than splitting it by spaces and printing back each word one at a time. -David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: Strange scalar behavior

2002-01-29 Thread Tanton Gibbs
It is the desired behavior under cygwin when you specified it to use unix crlf. You can actually tell cygwin to use windows crlf if that is what is desired. - Original Message - From: "David Blevins" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 7:37 PM Subje

RE: Strange scalar behavior

2002-01-29 Thread David Blevins
Wait, I got it, but it's something worth putting into an FAQ or something. I added the lines: $status += ""; $assignedto += ""; And got the output: Argument "" isn't numeric in addition (+) at ./task_notification.pl line 46, line 20. Argument "Open\r" isn't numeric in addition (+) at .

Re: Strange scalar behavior

2002-01-29 Thread Jenda Krynicky
From: "David Blevins" <[EMAIL PROTECTED]> > Background: I get automated emails that contain information about > project tasks (this is a sourceforge project). As I am the project > admin, I get all emails. > > Here is a shortened version of the program. I'm a terrible perl > pr

Re: quick POP3 question

2002-01-29 Thread Jenda Krynicky
From: "Chris Zampese" <[EMAIL PROTECTED]> >I have the Mail::Pop3Client module installed. I have it running >with the > debug option on, and it appears to me that the server > (pop3.xtra.co.nz) is accepting the user and password that I send (it > says OK please send PASS

Strange scalar behavior

2002-01-29 Thread David Blevins
Hi All, You'll have to bare with me on this one as I can post code to repeat the problem. I hope I can give enough details so that the cause of the "problem" is clear. Background: I get automated emails that contain information about project tasks (this is a sourceforge project). As I am the pr

Re: quick POP3 question

2002-01-29 Thread Chris Zampese
thanks for the advice, but I think that it is a problem with the way the network is set up as I am running that exact code (straight from the documentation). Cheers anyway :) this was in reply to... I have the Mail::Pop3Client module installed. I have it running with the debug option on,

Re: 2 questions

2002-01-29 Thread Curtis Poe
--- Naveen Parmar <[EMAIL PROTECTED]> wrote: > 1) How do you define global & lexical variables in Perl? > 2) Is the arrow (->) a commonly used Perl operator? > > TIA, > - NP Global variables may be defined in several different manners. 1. Fully qualified with package name: package Foo;

RE: newbie question

2002-01-29 Thread Hanson, Robert
"make" is a utility for managing programming projects. The "Makefile" is a script that tells make how to do stuff. When you install a Perl module it looks like this: perl Makefile.PL >> This is a perl script that creates a file called "Makefile" based on your configuration. make >> The progr

Re: newbie question

2002-01-29 Thread Clarke
$ man make ;-) Clarke - Original Message - From: Thunem, Tom <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 5:45 PM Subject: newbie question > I've never understood what the 'make' and 'make install' commands do. Can > someone shed the light? > > Thanks

RE: 2 questions

2002-01-29 Thread Hanson, Robert
All variables are global in nature unless you declare them in a lexical scope. $foo = "Hello Naveen"; if ( 1 ) { my $x = 1; } In this example $foo is global, and $x is local to the if-block only. And yes, -> is used quite often when you start using references or classes (a module that acts l

newbie question

2002-01-29 Thread Thunem, Tom
I've never understood what the 'make' and 'make install' commands do. Can someone shed the light? Thanks Tom Thunem Sr. Systems Specialist, Global E-Business Infrastructure, Americas Avnet, Inc. [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

RE: Perl path for windows 98

2002-01-29 Thread McCollum, Frank
Sure. Assuming perl is in the default location type "#!C:/Perl/bin/Perl.exe" If this does not work Alternatively, go to My Computer -> View -> File Types -> Add a new type -> Call it Perl -> specify ".pl" as extension -> Add an action called "Open" -> then "C:\Perl\bin\Perl.exe "%1" %*" in t

RE: Perl path for windows 98

2002-01-29 Thread Timothy Johnson
Oh, you want to run it without the extension! Now that's a different question than I thought you were asking. You need to add the .pl extension to the PATHEXT environment variable. I'm not 100% sure of the best way to do this in W98. You might be able to get away with adding the line: SET PA

2 questions

2002-01-29 Thread Naveen Parmar
1) How do you define global & lexical variables in Perl? 2) Is the arrow (->) a commonly used Perl operator? TIA, - NP _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAI

Re: Perl path for windows 98

2002-01-29 Thread Angus Laycock
Tim, I have loaded up ActivePerl and read the Readme file and run the example.pl script which said it loaded OK. But reading on it said that the extension should be set up. I have checked my Settings > Folder options > file types and there is no PERL or PL extension. I was curious if there was so

RE: Perl path for windows 98

2002-01-29 Thread Hanson, Robert
The shebang line (#!) is ignored in Windows*, but if the file association of Perl is set up correctly Windows should be able to run it just by typing "myscript.pl" at the command line. * Any flags on the shebang line will be used. Like warnings (-w) and such. Rob -Original Message- Fro

RE: Perl path for windows 98

2002-01-29 Thread Timothy Johnson
When you say that you "downloaded PERL", what distribution did you download? For Win32 platforms, the standard seems to be ActivePerl, which can be found at http://www.activestate.com. Running the Installer on their site should set up the appropriate file associations. The #! line is not applic

Perl path for windows 98

2002-01-29 Thread Angus Laycock
Hi, I have just downloaded PERL and set it up on my machine at home. Is there a path (#!/whatever ) I can put at the top of my script instead of typing "perl myscript.pl" to execute the script in Windows 98. Thanks in Advance Gus

RE: Question on PERL coding style...

2002-01-29 Thread Curtis Poe
--- John <[EMAIL PROTECTED]> wrote: > If you put them in a module are they parsed before they are called? > Does it matter whether you use "use" or "require"? When is it better > to specify subroutines when you use "use"? See perldoc -f use and perldoc -f require. "use" happens at compile tim

Re: function prototyping

2002-01-29 Thread Curtis Poe
--- John <[EMAIL PROTECTED]> wrote: > Does anyone have a cheetsheat for function prototyping - how to say > that a parameter is a scalar, array, hash, reference, etc., and whether > it is required or optional? John, Here's the cheatsheet for function prototypes: Don't use 'em. There are

Re: function prototyping

2002-01-29 Thread Chas Owens
On Tue, 2002-01-29 at 15:38, John wrote: > Does anyone have a cheetsheat for function prototyping - how to say > that a parameter is a scalar, array, hash, reference, etc., and whether > it is required or optional? > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For addi

Re: a very simple question

2002-01-29 Thread Jonathan E. Paton
> I assume you want > > $str = $1 if $str =~ /(\d\d\s*$)/; > > always make sure to test for a match before using $1, $2, > etc. If you don't you may get a runtime warning. Only when you try to use $str later when it is undefined. It should be checked, but perhaps not in the same place. Thi

RE: a very simple question

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, [EMAIL PROTECTED] said: >I am sure we could do it in one step as this: > $str =~ s/(\d\d\s*)$/$1; No, that's missing the last /, and all it does is replace what it matches with itself. ($str) = $str =~ /(\d\d\s*)$/; works, though. >> $str =~ /(\d\d\s*)$/; >> $str = $1; Thi

RE: a very simple question

2002-01-29 Thread Jonathan E. Paton
> Tanton: > > I am sure we could do it in one step as this: > $str =~ s/(\d\d\s*)$/$1/; > > Right? Sorta, that'll take the end of the string according to the match, and REPLACE IT with the end of the string - handy huh. So it matches: '34 ' from: 'JunkJunkJunk34 ' and adds it to

Re: a very simple question

2002-01-29 Thread Chas Owens
I assume you want $str = $1 if $str =~ /(\d\d\s*$)/; always make sure to test for a match before using $1, $2, etc. If you don't you may get a runtime warning. On Tue, 2002-01-29 at 16:12, Dhiraj P Nilange wrote: > > Hello > actually its very simple to answer for who knows basic perl. > > Su

Re: a very simple question

2002-01-29 Thread Tanton Gibbs
yep, that'll work too. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 4:18 PM Subject: RE: a very simple question > Tanton: > > I am sure we could do it in one step as this: > $str =~ s/(\d\

function prototyping

2002-01-29 Thread John
Does anyone have a cheetsheat for function prototyping - how to say that a parameter is a scalar, array, hash, reference, etc., and whether it is required or optional? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Set Up variables

2002-01-29 Thread Jose Vicente
Hi, again. What I have to do in this case: in README file of that module I find: set-up these environment variables: DBI_DSN The dbi data source, e.g. 'dbi:ODBC:YOUR_DSN_HERE' DBI_USER The username to use to connect to the database DBI_PASS The username to use to connect to the

RE: quick POP3 question

2002-01-29 Thread Jose Vicente
Hi friends. I am looking for a module to access "ACCESS DATABASES", please if you have any information send me it. Thanks in advance. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Question on PERL coding style...

2002-01-29 Thread John
If you put them in a module are they parsed before they are called? Does it matter whether you use "use" or "require"? When is it better to specify subroutines when you use "use"? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: a very simple question

2002-01-29 Thread Jonathan E. Paton
> Suppose I have a string in $str, I want to extract > some part of it based on regex and store it in the > same string. how do I do that? > > say... > > $str=~ $str /\d\d\s*$/; ($str) = $str =~ /(\d\d)\s*$; # Takes last two digits # off end of string Jonathan

RE: dir/file from ftp site

2002-01-29 Thread Hanson, Robert
The ls -l is the only way I can think of, and it is pretty easy to parse the output. # Your @data will come from the FTP server, mine came from # the command line. my @data = `ls -l`; for ( @data ) { my $idDirectory = (/^/) ? 1 : 0; my $filename = [split /\s+/]->[8];

RE: a very simple question

2002-01-29 Thread RArul
Tanton: I am sure we could do it in one step as this: $str =~ s/(\d\d\s*)$/$1; Right? -- Rex > -Original Message- > From: Tanton Gibbs [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 29, 2002 4:18 PM > To: Dhiraj P Nilange; [EMAIL PROTECTED] > Subject: Re: a very simple qu

Re: a very simple question

2002-01-29 Thread Tanton Gibbs
Just put the part you want to extract in parentheses and then set $str equal to $1...for example: $str =~ /(\d\d\s*)$/; $str = $1; - Original Message - From: "Dhiraj P Nilange" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 4:12 PM Subject: a very simple quest

a very simple question

2002-01-29 Thread Dhiraj P Nilange
Hello actually its very simple to answer for who knows basic perl. Suppose I have a string in $str I wanto extract some part of it based on regex and store it in the same string. how do i do that? say... $str=~ $str /\d\d\s*$/; but this doesnt work. seems some syntax problem.. help -dhiraj

Re: writing formats

2002-01-29 Thread William.Ampeh
The trick is to make sure that your output file has the same name as your main format routine. So in my case I have: select ("STDOUT"); and format STDOUT = The STDOUT_TOP is automatically selected at the beginning of each page. Maybe this will help (that is if it is not too late) The out

Re: File Flushing

2002-01-29 Thread Peter Scott
At 03:39 PM 1/29/02 -0500, [EMAIL PROTECTED] wrote: >Friends, > >How can we can programatically control the flushing out of an output buffer >so that during an iterative process, the contents can be periodically >flushed out to the output buffer? > >Say, in this test snippet code, what should I do

dir/file from ftp site

2002-01-29 Thread Dhiraj P Nilange
I want to connect to a ftp site and in I want to get a list of all files and directories in some given directory. I know how to do that using Net::FTP package. I want to know that after issuing what will be easiest way to check whether each entry in the directory list is a file or a directory? I

File Flushing

2002-01-29 Thread RArul
Friends, How can we can programatically control the flushing out of an output buffer so that during an iterative process, the contents can be periodically flushed out to the output buffer? Say, in this test snippet code, what should I do in order to flush the contents for every 10th record? - Re

Re: writing formats

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, Thunem, Tom said: >can anyone tell me how to toggle between 2 different formats writing to the >same output filehandle? i am not having luck with coding the select and >write statements. By default, the format for any given filehandle has the same name as the filehandle itself. To c

Sending Faxes

2002-01-29 Thread Robert Thompson
Hello, I am looking for a module that will help in sending an html form to a fax machine. I did a search on CPAN and google. CPAN did not have anything that I could find. Google pulled up some Win32 modules for faxing, but I am using *nix. Is there a module for *nix that will help with

writing formats

2002-01-29 Thread Thunem, Tom
can anyone tell me how to toggle between 2 different formats writing to the same output filehandle? i am not having luck with coding the select and write statements. thanks Tom Thunem Sr. Systems Specialist, Global E-Business Infrastructure, Americas Avnet, Inc. [EMAIL PROTECTED] -- To unsub

Re: Win32 Question - Detecting floppy in drive...

2002-01-29 Thread Sean O'Leary
Wow, a Prodigy email address... I remember using them back in the day. I'm kinda surprised they are still with us. At 12:25 PM 1/28/2002, you wrote: >In VB, I can make an API call (Can't remember what it is off the top of my >head) that will basically look at the drive and detect if I need to p

Re: mailing captured output with template text

2002-01-29 Thread Gary
You have gotten lots of suggestions about the system call etc. So I do not have much to say about that other than to point out that the code you have written is not very portable (since it relies on the unix command df). If you want a platform independent solution there is a perl alternative to

Re: Two dimensional hash

2002-01-29 Thread Jonathan E. Paton
> > Suppose I have a two dimensional hash: > > > > $name{Adams}{Alice} = 1; > > $name{Adams}{Bob} = 2; > > $name{Bull}{Adam} = 3; etc. > > > > Given the first key, is there a way to pull out > > a second key, if I don't care which one? > > my ($first) = keys %{$name{Adams}}; > That answers

RE: Question on PERL coding style...

2002-01-29 Thread McDonald Patrick
Perl will only execute subroutines when called. It is recommended that you group all subroutine defintions either at the beginning or the end of the program. Pat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 1:38 PM To: [EMAIL PROT

Re: comparing strings

2002-01-29 Thread Collins, Joe (EDSI\\BDR)
Worth reading, including the end where Jonathan expands on his earlier post. -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 1:32 PM To: Collins, Joe (EDSIBDR) Subject: RE: Comparing strings | > Don't know if this helps, but the follo

RE: Question on PERL coding style...

2002-01-29 Thread Hanson, Robert
It goes around it. You need to call a subroutine for it to be executed... although it will still be compiled, which could cause compilation errors even before the script starts to run. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2

Re: Two dimensional hash

2002-01-29 Thread Matt C.
This works for me from the command line. I like the "arrow" syntax for datastructures, as it allows me mind to see what's going on (which is hard for me to do sometimes with datastructures). perl -e "$name{adams}{alice}='HELLO WORLD'; print $name{adams}->{alice};" The camel book has a ton of stu

Question on PERL coding style...

2002-01-29 Thread Richard.C.1
This might be a really strange question, but I need to ask - Does PERL execute from beginning through the program in a linear fashion, "jumping around" subroutines unless they're called? I have a program that's structured as shown below (assume vars and statements are different) and need to know

parsing output

2002-01-29 Thread Duarte Cordeiro
Helo, this is my first try with perl. I've programmed mainly in C-style languages and lisp, and I know that my code isn't very "perl-like". So, can somebody enlight me of a better way to right this ? Thanks for your time, Duarte Problem: Write a program that receives two arguments: a ip ad

Re: Comparing files

2002-01-29 Thread Jason Purdy
*laugh* - Thanks for the pointers and consider myself better learned. :) Hmm ... now I better go & hunt down all those greps in my scripts... Jason If memory serves me right, on Tuesday 29 January 2002 13:26, Jeff 'japhy' Pinyan wrote: > On Jan 29, Jason Purdy said: > >my ( @filea, @fileb, @in

Re: Comparing files

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, Jason Purdy said: >my ( @filea, @fileb, @inAButNotInB, @inBButNotInA ); I don't see any hashes being used. This feels like it's going to be very inefficient. >open ( FILEA, shift ) || die "Cannot open 1st file: $!\n"; >@filea = ; >close ( FILEA ); > >open ( FILEB, shift ) || die "C

RE: Remain Days of Month & Leap Year Question

2002-01-29 Thread Timothy Johnson
You can also check out the Date::Calc module at www.engelschall.com/u/sb/download/Date-Calc/ It simplifies a lot of date calculations including the number of days in the month, days 'till the end of the year, leap years, etc. -Original Message- From: Darryl Schnell [mailto:[EMAIL PROTEC

Re: Comparing files

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, [EMAIL PROTECTED] said: >1- report any objects in File A that are not in File B >2- report any objects that are in File B but not in File A This sounds like the job for two hashes. It also happens to be in the FAQ under the heading "How do I compute the difference of two arrays? How

RE: TIME

2002-01-29 Thread Timothy Johnson
Here's a snippet of code I use to refresh my memory from time to time as to what localtime() returns. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); The only thing you have to remember is that the $mon variable is actually one less than the current month(it starts at 0), a

RE: Redirect error to file using system()

2002-01-29 Thread Kipp, James
thanks I was able to do it by redirection teh FD sterr -Original Message- From: Daniel Gardner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 12:58 PM To: Kipp, James Cc: [EMAIL PROTECTED] Subject: Re: Redirect error to file using system() Does IPC::Open3 help? That sends th

Re: quick POP3 question

2002-01-29 Thread Sean O'Leary
At 05:55 AM 1/29/2002, you wrote: >I have the Mail::Pop3Client module installed. I have it running with the >debug option on, and it appears to me that the server (pop3.xtra.co.nz) is >accepting the user and password that I send (it says OK please send PASS >command, then OK /USER? is welcome)

Re: Redirect error to file using system()

2002-01-29 Thread Daniel Gardner
Tuesday, January 29, 2002, 3:38:20 PM, Kipp, James wrote: > I am working on an NT script which uses system(). I can not get it to write > errors to stderr instead of stdout. it works fine from the command line. see > code snip below. any ideas? > thanks > Jim > -- > foreach $user (@users) > { >

Re: Comparing files

2002-01-29 Thread Jason Purdy
Feel like I'm back in comp-sci, but this time, they'll actually let me use a real language (don't get me started on "Turing" ;)). I wrote this simple script that should work with 5.003... Jason #!/usr/bin/perl -w # call this with 2 params, such as # > diff.pl [file1] [file2] use strict; m

Re: forking perl

2002-01-29 Thread Tanton Gibbs
pretty much you can just make minor changes and say my $pid; for my $node(@devices) { if( $pid = fork ) { next; } elsif( defined( $pid ) ) { #do subroutines here on $node } else { die "Could not fork!\n"; } } This way, you will spin off one process for each node in the de

Re: Comparing files

2002-01-29 Thread charles
If you are just looking to see if X from file one is in file two, and vice versa, you may want to look at p147 in the Cookbook. It's example is comparing the hash keys of two seperate hashes. If you place each line of your file into a hash and the other file in another hash, and compare the to

RE: Remain Days of Month & Leap Year Question

2002-01-29 Thread Darryl Schnell
Thank-You all regarding this matter. It works great. I should have been able to figure this one out on my own, guess I need to brush or relearn how to use the Time function. Thanks Again, -Original Message- From: Jason Purdy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 12:

forking perl

2002-01-29 Thread charles
hello all, i am thinking of adding the ability to fork into a script i've written recently. the script acts on a list of nodes. currently it does this, one at a time, which could prove to be a lengthy process for longer lists. i was thinking that fork would allow me to spawn child pids and spee

Comparing files

2002-01-29 Thread ABhagwandin
I have two lists of objects in two files. I need a way to compare these two files and: 1- report any objects in File A that are not in File B 2- report any objects that are in File B but not in File A 3- Restriction: I am not working with a modern version of Perl, I am restricted to the followin

Re: Remain Days of Month & Leap Year Question

2002-01-29 Thread Jason Purdy
Leap-year is a little more complicated than that (from http://www.ips.gov.au/papers/richard/leap.html): "A year is a leap year (and so contains a February 29) if it is divisible by 4. But if the year is also divisible by 100 then it is not a leap year, unless it is divisible by 400." A neater

RE: Redirect error to file using system()

2002-01-29 Thread Kipp, James
from a command line 2> will redirect standard error. open(STDERR,">err.out"); works fine, thanks -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 10:50 AM To: 'Kipp, James '; [EMAIL PROTECTED] Subject: RE: Redirect error to file using sys

Re: Remain Days of Month & Leap Year Question

2002-01-29 Thread Jason Purdy
I would install (if it's not on your system already) and check out the documentation for Time::Local. It will allow you to set up the date from a month, day and year, from which, you could work it out. I wrote this (baby-talk) script that would output the last day given the month (from 0-11):

RE: Remain Days of Month & Leap Year Question

2002-01-29 Thread McCollum, Frank
I've never done this, but it seems to me it would be nice to set up the days per month in a little hash table. %calendarDays ( january => 31, february => 28, ) #or should the order be reversed? I'm not that familiar with Hashes. Then have a check in there that grabs the date (see previous e

Re: Remain Days of Month & Leap Year Question

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, Darryl Schnell said: >I am currently working on a prorate billing routine for an online form >and need a bit of guidance. The idea behind the program is to take 19.95 >and divde that by the total of remain days in the month, using the day >of the month the user filled out the form as t

Remain Days of Month & Leap Year Question

2002-01-29 Thread Darryl Schnell
Greeting's All, I am currently working on a prorate billing routine for an online form and need a bit of guidance. The idea behind the program is to take 19.95 and divde that by the total of remain days in the month, using the day of the month the user filled out the form as the starting point

Re: TIME

2002-01-29 Thread Jason Purdy
I'm sure you'll get a lot of feedback on this, but here's my first stab: Check out 'perldoc -f localtime' localtime is the function I believe you're looking for, which will return an array of local time information that you can use however you want. Jason If memory serves me right, on Tuesday

Re: TIME

2002-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, Amy sing said: >Does anyone have a script that will give the local >time.. please help.. perl -le 'print scalar localtime' perldoc -f localtime perldoc -f gmtime -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.

Re: TIME

2002-01-29 Thread Tanton Gibbs
my $time = localtime; print "$time\n"; perldoc localtime - Original Message - From: "Amy sing" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 29, 2002 11:17 AM Subject: TIME > Does anyone have a script that will give the local > time.. please help.. > > _

TIME

2002-01-29 Thread Amy sing
Does anyone have a script that will give the local time.. please help.. __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

  1   2   >