Copy file output to a text file

2001-10-03 Thread Daniel Falkenberg
> List, > > I have this problem that has been bothering me all day. All I want is > to be able to copy the out put of ifconfig to a text file > /etc/ppp/ppp.txt > > I have tried so many things but I can't get it to work. Once I have > done this I need to be able to extract the ADSL ip address

RE: problem in writing code(switch/case)or enum

2001-10-03 Thread Gibbs Tanton - tgibbs
Well, you could use an array: my @months = qw(JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC); then you can say $months[$s_month-1] to get the string value. -Original Message- From: Rahul Garg To: [EMAIL PROTECTED] Sent: 10/4/2001 1:54 AM Subject: problem in writing code(switch/case)o

problem in writing code(switch/case)or enum

2001-10-03 Thread Rahul Garg
what i want is : $s_month can be 1 to 12 if($s_month == 1){$s_month = 'JAN'};and so on how can i do it.

Re: Don't print...

2001-10-03 Thread Mel Matsuoka
At 04:02 PM 10/04/2001 +0930, Daniel Falkenberg wrote: >List, > >Can some one tell me why it is that the following code prints the >results on the screen when I don't have the print command in there at >all??? > >$shell = ifconfig("ppp0"); >cp($shell, "/etc/ppp/ppp"); Probably something in your i

Don't print...

2001-10-03 Thread Daniel Falkenberg
List, Can some one tell me why it is that the following code prints the results on the screen when I don't have the print command in there at all??? $shell = ifconfig("ppp0"); cp($shell, "/etc/ppp/ppp"); Regards, Dan == VINTEK CONSULTING PTY LTD (ACN 088 825 209) E

Re: Piping ifconfig to a text file

2001-10-03 Thread Brett W. McCoy
On Thu, 4 Oct 2001, Daniel Falkenberg wrote: > List, > > Can some one help me with opening ifconfig and pipe it to a text file. > Then I want to be able to view that file. > > How would I go about this? > > open IFCONFIG, "/sbin/ifconfig"; > $file=; > print $file; You've almost got it: open(I

RE: Piping ifconfig to a text file

2001-10-03 Thread Wagner-David
If you really want to get the whole file and print it, then you would need to shutoff the input record separator and print it out: undef $/; $file = ; printf $file or change $ to @ and it would read the whole file in: @file = ; print @file; Wags

Piping ifconfig to a text file

2001-10-03 Thread Daniel Falkenberg
> List, > > Can some one help me with opening ifconfig and pipe it to a text file. > Then I want to be able to view that file. > > How would I go about this? > > open IFCONFIG, "/sbin/ifconfig"; > $file=; > print $file; > > > > Kind regards, > > Daniel Falkenberg > >

Piping ifconfig to a text file

2001-10-03 Thread Daniel Falkenberg
List, Can some one help me with opening ifconfig and pipe it to a text file. Then I want to be able to view that file. How would I go about this? open IFCONFIG, "/sbin/ifconfig"; $file=; print $file; Kind regards, Daniel Falkenberg == VINTEK CONSULTING PTY

Re: encrypt, decrypt module suggestions

2001-10-03 Thread jeffl
Rex, Elaine thanks. I read you're suggestion Elaine, informative, thanks. Rex, thanks I think I'll try the Crypt::RC4 module. jeffl On 2001.10.03 20:49 Rex Arul wrote: > Use Crypt::RC4 module, to encrypt and decrypt values. It uses the RC4 > Symmetric encryption which is fairly robust. It depend

Re: encrypt, decrypt module suggestions

2001-10-03 Thread Rex Arul
Use Crypt::RC4 module, to encrypt and decrypt values. It uses the RC4 Symmetric encryption which is fairly robust. It depends on a symmetric key which you will use for encryption as well as decryption. You can download the latest Crypt::RC4 module through PPM. (Activestate Perl). http://aspn.act

Re: encrypt, decrypt module suggestions

2001-10-03 Thread Elaine -HFB- Ashton
Jeff Loetel [[EMAIL PROTECTED]] quoth: *> *>Suggestions appreciated. http://www.perl.com/pub/a/2001/09/26/crypto1.html e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

encrypt, decrypt module suggestions

2001-10-03 Thread Jeff Loetel
I'm looking for a module where I can encrypt and decrypt values. Obviously, the more secure the better. Most of everything that I have seen is in the way of one way hash digests. The main thing is I have to be able to get the values back out. Suggestions appreciated. jeffl -- To unsubscribe,

Re: Hash keys

2001-10-03 Thread Brett W. McCoy
On Wed, 3 Oct 2001, Tyler Cruickshank wrote: > I have a hash that I am storing arrays in. Each array corresponds to > one hour of a day. After the hash has been populated I need to cycle > through the "days" and sum them up. So, I have written my hash such > that each key can be looped thru vi

Re: Hash keys

2001-10-03 Thread Michael Fowler
On Wed, Oct 03, 2001 at 03:12:55PM -0600, Tyler Cruickshank wrote: > I have a hash that I am storing arrays in. Each array corresponds to one > hour of a day. After the hash has been populated I need to cycle through > the "days" and sum them up. So, I have written my hash such that each key >

Re: Hash keys

2001-10-03 Thread Curtis Poe
--- Tyler Cruickshank <[EMAIL PROTECTED]> wrote: > My keys are simply data.hr1, data.hr2, data.hr3, where each key is incremented via >the for loop. > The problem seems to be that when I use $specSum{$name}[$i] where $name would be >data.hr1, > data.hr2, data.hr3 ... it doesnt work. How can I

Hash keys

2001-10-03 Thread Tyler Cruickshank
Hello, I continue to have difficulties using hashes. I have a hash that I am storing arrays in. Each array corresponds to one hour of a day. After the hash has been populated I need to cycle through the "days" and sum them up. So, I have written my hash such that each key can be looped th

Re: Data Structures

2001-10-03 Thread Curtis Poe
--- David Gilden <[EMAIL PROTECTED]> wrote: > Hi, > > I am having bit of a struggle getting the following code to work: > > Here are my two questions, first is there a cleaner way of dealing the 'radio button >group' > next is the building of a hash of hashs, and I can not seem to sort des

Re: Math and Perl

2001-10-03 Thread Brett W. McCoy
On Wed, 3 Oct 2001, Sofia wrote: > I am doing some division in my perl program but the > result of the division is a number with many decimal > places (12.34567899) How can I truncate the number to > just two decimal places and round up or down if > necessary? Is there a module that will let me

RE: Math and Perl

2001-10-03 Thread Bob Showalter
> -Original Message- > From: Sofia [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 03, 2001 4:57 PM > To: [EMAIL PROTECTED] > Subject: Math and Perl > > > I am doing some division in my perl program but the > result of the division is a number with many decimal > places (12.3456789

Math and Perl

2001-10-03 Thread Sofia
I am doing some division in my perl program but the result of the division is a number with many decimal places (12.34567899) How can I truncate the number to just two decimal places and round up or down if necessary? Is there a module that will let me specify the number of decimal places I want

Re: Data Structures

2001-10-03 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (David Gilden) wrote: > Here are my two questions, first is there a cleaner way of dealing > the 'radio button group' next is the building of a hash of hashs, and > I can not seem to sort desired criteria. As a PERL neophyte all help > is app

Re: Connecting to an Access/MySQL database

2001-10-03 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Greg Froese) wrote: > what module(s) would I need to connect to an access database? use the DBI module. http://search.cpan.org/search?dist=DBI perhaps with an ODBC driver http://search.cpan.org/search?dist=DBD-ODBC > and if I code a

Connecting to an Access/MySQL database

2001-10-03 Thread Greg . Froese
what module(s) would I need to connect to an access database? and if I code an app that uses an access database, can that be easily changed to MySQL or whatever just by changing the connect string? TIA Greg

Re: DELETE BLANK LINE

2001-10-03 Thread Bill Jones
On 10/3/01 11:49 AM, "Pedro A Reche Gallardo" <[EMAIL PROTECTED]> wrote: > By a blank line I mean any line containing only white spaces, > return, tab characters etc. chomp; s/\w//g; print "Non-white space still in there\n" unless length; ??? -Sx- -- To unsubscribe, e-mail: [EMAIL

Data Structures

2001-10-03 Thread David Gilden
Hi, I am having bit of a struggle getting the following code to work: Here are my two questions, first is there a cleaner way of dealing the 'radio button group' next is the building of a hash of hashs, and I can not seem to sort desired criteria. As a PERL neophyte all help is appreciated

Re: Perl and DBI what is needed..

2001-10-03 Thread Michael Fowler
On Tue, Oct 02, 2001 at 10:10:35PM -0400, R Talbot wrote: > When I ran ./configure on PostgreSQL 7.1.2 I did so --with-perl but make > reported It could not install because Perl libraries were not shared.. I > assume it wanted me to have the Perl static installed and linked.. Right > or wrong?? N

Re: index of an array element

2001-10-03 Thread Michael Fowler
On Wed, Oct 03, 2001 at 07:09:36PM +0530, [EMAIL PROTECTED] wrote: > I am not using hashes for the same reason described by Rex, i.e.. My list might > not a key=value pair everytime. The list could be for example > ("GMM_ASSIGN_REQ", "TLLI=0x123456", "TLLI_INDEX=00", "LLC_PDU=$pdu); > > Here , th

Re: fork function

2001-10-03 Thread Michael Fowler
On Wed, Oct 03, 2001 at 11:19:09AM +0200, walter valenti wrote: > i've some difficulty on the use of fork function. > I know that the fork function make a process child, but the i don't know > how write the code. Have you read perldoc -f fork and perldoc perlipc? What difficulty are you having?

Re: dot-named sub

2001-10-03 Thread Michael Fowler
On Wed, Oct 03, 2001 at 09:48:32AM +0200, Josi Luis Sancho wrote: > I am using XML::Grove and Data::Grove::Visitor to parse SGML/XML > documents; the visitor package generates calls back by element names; > unfortunately I face dot-named elements and I MUST parse them by means of > identically dot

Re: eval problem

2001-10-03 Thread Michael Fowler
On Wed, Oct 03, 2001 at 11:01:48AM +0530, [EMAIL PROTECTED] wrote: > so my earlier effort was basically to find out how we can capture the > output of "eval($temp)" into a Perl variable, ...this variable could later > be taken from the Perl stack ,converted into a C string and sent through > the p

Re: Merge documents

2001-10-03 Thread Bill Jones
On 10/2/01 9:05 PM, "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > All things are possible with Perl. > Well, caveats apply. -Sx- :] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: DELETE BLANK LINE

2001-10-03 Thread Gibbs Tanton - tgibbs
Assuming you have a loop like while( <> ) { } you could say while( <> ) { next if /^\s*$/; } That will find a line that contains any number of whitespace characters, or no characters at all. Note that you do need the ^$ characters to make sure it matches the whole string; otherwise, you w

DELETE BLANK LINE

2001-10-03 Thread Pedro A Reche Gallardo
Hi all, I am sure someone has already asked this but I do not remeber the answer. How can I delete or go to the next line if a blank line is found. By a blank line I mean any line containing only white spaces, return, tab characters etc. Regards, Pedro -- **

Re: Deleting an element from an array.

2001-10-03 Thread Randal L. Schwartz
> "Brett" == Brett W McCoy <[EMAIL PROTECTED]> writes: Brett> On Wed, 3 Oct 2001, Mason, Andrew wrote: >> Say I have an array @array = ( 1, 2, 3, 4, 5) >> >> I know I want to remove the second value, $array[2]. How should I do >> this? Brett> Take a look at the perldoc for 'split'. It doe

Re: Deleting an element from an array.

2001-10-03 Thread Jeff 'japhy' Pinyan
On Oct 3, Mason, Andrew said: >Say I have an array @array = ( 1, 2, 3, 4, 5) > >I know I want to remove the second value, $array[2]. How should I do >this? You want splice(). splice @array, $offset, $length, @replacement; In your case, $offset is 2, $length is 1, and there is no @replacemen

Re: Deleting an element from an array.

2001-10-03 Thread Brett W. McCoy
On Wed, 3 Oct 2001, Mason, Andrew wrote: > Say I have an array @array = ( 1, 2, 3, 4, 5) > > I know I want to remove the second value, $array[2]. How should I do > this? Take a look at the perldoc for 'split'. It does what you want to do. http://www.c

Deleting an element from an array.

2001-10-03 Thread Mason, Andrew
Say I have an array @array = ( 1, 2, 3, 4, 5) I know I want to remove the second value, $array[2]. How should I do this? Is it possible to issue a command that just does this for me or do I have to loop through setting $array[n]=$array[n+1] for n>which ever value I wish to remove? (I hope that

Re: index of an array element

2001-10-03 Thread Sudarsan Raghavan
In a later mail the OP has mentioned that her list may be of the form my @ops_list = ("a", "b=7", "c=8"); The first element does not have a "=" in it. I am assuming that the key that she uses for search here is "a". Your code snippet will return an undef when called with some_func (@ops_list, "a")

RE: index of an array element

2001-10-03 Thread RArul
Mini, In that case, my original supposition holds good. This code would work exactly for your case. #!/usr/bin/perl use strict; my($array) = ["GMM_ASSIGN_REQ", "TLLI=0x123456", "TLLI_INDEX=00", "LLC_PDU=blahblah"]; my($str) = 'LLC_PDU'; my($index) = indexOf($array,$str); print ("Index of $str i

RE: index of an array element

2001-10-03 Thread minid
I am not using hashes for the same reason described by Rex, i.e.. My list might not a key=value pair everytime. The list could be for example ("GMM_ASSIGN_REQ", "TLLI=0x123456", "TLLI_INDEX=00", "LLC_PDU=$pdu); Here , the first element is not stored as key value pair. Regards, -Mini. [EMAI

Re: index of an array element

2001-10-03 Thread Sudarsan Raghavan
[EMAIL PROTECTED] wrote: > For key-value pair type of lists, hashes are the way to go. I had shown the > other way using a list, which does not need the 'key-value' caveat. > > However for your case, Mini, you need to tread the hash path as shown by > Sudarshan. > > Here is a code snippet you can

RE: index of an array element

2001-10-03 Thread RArul
For key-value pair type of lists, hashes are the way to go. I had shown the other way using a list, which does not need the 'key-value' caveat. However for your case, Mini, you need to tread the hash path as shown by Sudarshan. Here is a code snippet you can try. #!/usr/bin/perl my($hash) = {a

Re: index of an array element

2001-10-03 Thread Sudarsan Raghavan
[EMAIL PROTECTED] wrote: > Rex, in you r previous mail, we explicity need to give > $str = 'd=4' ; .It is simple to give it here as I know the > key=value pair for d i.e.. d=4. But I want to use function with very large If it is a list of key=value pairs a hash is the ideal w

Re: index of an array element

2001-10-03 Thread minid
Rex, in you r previous mail, we explicity need to give $str = 'd=4' ; .It is simple to give it here as I know the key=value pair for d i.e.. d=4. But I want to use function with very large lists, and I have to search my list for the key only i.e.. "d". thus, what I need is : $

Re: index of an array element

2001-10-03 Thread Sudarsan Raghavan
Rex Arul wrote: > But that would work only for key=value type of situations. My suggestion was based on the example list that the OP had mentioned. The elements of the form "d=9" is a key=value type of situation. > > > If @list = (2,'a',100,'cat') > > then you cannot rely on Hashes b

Re: index of an array element

2001-10-03 Thread Rex Arul
But that would work only for key=value type of situations. If @list = (2,'a',100,'cat') then you cannot rely on Hashes because order cannot be preserved. At such instances, you might need to code a custom function as shown in my previous mail. Right? -- Rex - Original Message - From:

Re: index of an array element

2001-10-03 Thread Sudarsan Raghavan
[EMAIL PROTECTED] wrote: > Hi , > > Say I have an array in perl, > > @list = ("a=3", "b=5", "c=8", "d=9", "e=2", "f=0"); looking at your list a hash seems like a better option, the hash will be like %hashlist = ( a => 3, b => 5,

Re: index of an array element

2001-10-03 Thread Rex Arul
Will this be sufficient? my($array) = ['a=1', 'b=2', 'c=3', 'd=4']; my($str) = 'd=43'; my($index) = indexOf($array,$str); print ("Index of $str in the array is = $index"); sub indexOf{ my($arr) = shift; my($val) = shift; for(my $i=0; $i < @{$arr}; $i++){ return($i) if($arr->[$i] eq $val);

index of an array element

2001-10-03 Thread minid
Hi , Say I have an array in perl, @list = ("a=3", "b=5", "c=8", "d=9", "e=2", "f=0"); Now I want to find the index of the element "d=9" ( Index of d=9 is 3 here , as we all know ). How do we do that ?? In perl what I can find that there exist a function "index", which returns position of th

Re: problem in knowing session variables .

2001-10-03 Thread Rex Arul
Rahul -- The Server sets the ASPSessionID if you have enabled the Session state for your web server. To access the collection of session variables and the corresponding values, you might need to write some code as follows: foreach $key (in $Session->Contents){ $Response->Write(qq{ Session Var

fork function

2001-10-03 Thread walter valenti
Hi, i've some difficulty on the use of fork function. I know that the fork function make a process child, but the i don't know how write the code. Thanks Walter _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.

RE: How can i establish sessions in Perl

2001-10-03 Thread Jade E. Deane
Can you be a little more vague? ;) -Original Message- From: Rahul Garg [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 03, 2001 1:03 AM To: [EMAIL PROTECTED] Subject: How can i establish sessions in Perl How can i establish sessions in Perl -- To unsubscribe, e-mail: [EMAIL PROT

How can i establish sessions in Perl

2001-10-03 Thread Rahul Garg
How can i establish sessions in Perl

Re: dot-named sub

2001-10-03 Thread José Luis Sancho
Brett W. McCoy wrote: > subroutines. The next question is, why do you *need* to have subroutine > names with dots in them? > I am using XML::Grove and Data::Grove::Visitor to parse SGML/XML documents; the visitor package generates calls back by element names; unfortunately I face dot-named elem