Re: structure of scripts (newbie Q)

2001-09-24 Thread Stephan Tinnemeyer
Thank you all for your comments! Because I am used to C/C++ I do not 'like' the usage of variables and subroutines before even declaration in a source code 'instinctively'. This is, of course, my personal spleen which may change with more experience in using Perl. brian d foy wrote: perl

reg exp match

2001-09-24 Thread David Draley
How would I print only the words that contain the letter p in a file??? Right now I am only printing the entire lines that contain words with the letter p. while (FILE) { if(/[p]/) { print $_;

Re: reg exp match

2001-09-24 Thread Curtis Poe
--- David Draley [EMAIL PROTECTED] wrote: How would I print only the words that contain the letter p in a file??? Right now I am only printing the entire lines that contain words with the letter p. while (FILE) { if(/[p]/) {

Re: reg exp match

2001-09-24 Thread Jarrod Overson
- Original Message - From: David Draley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 24, 2001 8:13 AM Subject: reg exp match How would I print only the words that contain the letter p in a file??? Right now I am only printing the entire lines that contain words with

How to ck for null set w/ Checkboxes

2001-09-24 Thread Teresa Raymond
How do you check for the null set or blank with checkboxes using CGI.pm? The following code does not work for checkboxes though it does for all other input fields. #TEST FOR BAD CHARS my ($name, $value); foreach $name ($q-param()) {foreach $value ($q-param( $name )) {#CK FOR BLANKS if

Array of Hashes?

2001-09-24 Thread Batchelor, Jonathan
I have a data structure similar to the following: @hosts = ( list of hashes like below ... ); %hosts = ( name = hostname, ipaddr = www.xxx.yyy.zzz, location = location ); How can produce a sorted list of the hashes based on the hostname and then access each

hello

2001-09-24 Thread kavitha malar
I want to take a win32 perl script to unix. Is their any document telling that what are the problems we are going to face, when we take the script to unix domain. Thanks jude

RE: hello

2001-09-24 Thread John Edwards
Things you need to look out for are file locations, adding the shebang to the top of the script (the #!/path/to/perl), directory paths that are specified as \\ instead of / and any Win32 specific modules. Other than that, test the script and see if it breaks... HTH John -Original

How many elements are there in a hash?

2001-09-24 Thread George S Pereira
Hi, I've got a number of elements that are specified in a hash. I need to find out the number of elements in the hash. Is there any quick way, like $#array for arrays. I can always move through the keys and increment a counter, but I'm looking for a shortcut. thanks. George P.

RE: How many elements are there in a hash?

2001-09-24 Thread John Edwards
$hash_length = scalar keys %hash; John -Original Message- From: George S Pereira [mailto:[EMAIL PROTECTED]] Sent: 24 September 2001 10:26 To: [EMAIL PROTECTED] Subject: How many elements are there in a hash? Hi, I've got a number of elements that are specified in a hash. I need to

global variables

2001-09-24 Thread Ruth Albocher
Hi. I would like to use a global variable in my perl application, but since everything in perl is in a package, it will always belong to some package. what can I do? thanks, ruthie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: global variables

2001-09-24 Thread Sascha Kersken
Hi! Perl 5.6 provides the 'our' statement as opposite to 'my': it makes a variable global to a file in which it's used. HTH Sascha - Original Message - From: Ruth Albocher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 24, 2001 1:01 PM Subject: global variables Hi.

Re: Perl by Example

2001-09-24 Thread Brent Michalski
Teresa, I'd have to highly recommend Writing CGI Applications with Perl. Myself and Kevin Meltzer wrote it, so we may be a bit biased towards it though But, it has received great reviews from several people. :o) Brent

Re: Perl by Example

2001-09-24 Thread John_Kennedy
While I really like using UNIX Shells by Example, PERL by Example has been a bit of a disappointment. The organization could be a bit better and some of the examples haven't worked well for me. I use Programming PERL by O'Reilly almost exclusively. John Teresa Raymond wrote: Has anyone

Re: searching file for presence of ALL values of a hash when the hash key is the position of the value on the file's line

2001-09-24 Thread Jos I. Boumans
i have to honestly say, i didnt read the entire problem, but i see a line in your code which you probably don't want: while (FILE) { my @line = split /\|/, FILE; the while thing puts the line in $_ you are then discarding that line, and reading hte *next* line in that file and feeding that to

TR: creating file

2001-09-24 Thread COLLINEAU Franck FTRD/DMI/TAM
Hi! I have a file with a line that is . I would like to create a file with all the lines after the line ___. I don't know how to do that Thanks Franck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

FW: system calls

2001-09-24 Thread Busse, Rich
For Windows NT, try system (start $command); For a load of options, enter start /? at the Windows NT command line. -Original Message- From: Najamuddin, Junaid [mailto:[EMAIL PROTECTED]] Sent: Friday, 21 September, 2001 14:56 To: 'Sidharth Malhotra'; Jonathan Howe; [EMAIL PROTECTED]

Re: store index numbers of all array1 elements in array2 whichequalkeys in a hash

2001-09-24 Thread Joyce Harris
I may be looking at this wrong, but it seems as though the preposed solution would work. Since the incrementing is done outside the brackets of the if statement, the index is incremented for each element regardless of the outcome of the if statement. Joyce - Original Message - From:

creating file

2001-09-24 Thread COLLINEAU Franck FTRD/DMI/TAM
Hi! I have a file with a line that is . I would like to create a file with all the lines after the line ___. I don't know how to do that Thanks Franck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re:Delete a line in a file

2001-09-24 Thread Jorge Goncalvez
Hi, I would delete a file if it is already present. for exemple I have: 1001337334: dhcpd : DHCPDISCOVER from 00:b0:d0:23:80:67 via eth0 1001337334: dhcpd : Reclaiming abandoned IP address 192.40.54.41. 1001337334: dhcpd : (DHCPDISCOVER) (ack_lease) CLASS_IDENTIFIER = PXEClient 1001337334:

Inserting into the middle of arrays

2001-09-24 Thread Pete Sergeant
How do I insert $scalar into position $x of @array, where $x is smaller than $#array? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

going down an uncharted path

2001-09-24 Thread Yacketta, Ronald
Folks, need a little assistance here, I finally have stumbled upon the need to make an interactive perl script. One that takes answers from stdin etc... I have written a few perl scripts that are not interactive, but never interactive. Could someone point me to some examples? please, dont send

Re: Inserting into the middle of arrays

2001-09-24 Thread Kevin Meltzer
perldoc -f splice @array = (1, 2, 3, 4, 5); splice(@array, 3, 1, 10); print @array; 1, 2, 3, 10, 5 Cheers, Kevin On Mon, Sep 24, 2001 at 03:08:09PM +0200, Pete Sergeant ([EMAIL PROTECTED]) said something similar to: How do I insert $scalar into position $x of @array, where $x is smaller

Re: Inserting into the middle of arrays

2001-09-24 Thread walter valenti
$array[$x]=$scalar; How do I insert $scalar into position $x of @array, where $x is smaller than $#array? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your

Re: Inserting into the middle of arrays

2001-09-24 Thread Andrea Holstein
Pete Sergeant wrote: How do I insert $scalar into position $x of @array, where $x is smaller than $#array? E.g.: @primes = (1, 2, 3, 5, 11, 13); # oh, I forgot one @primes = (@primes[0..3], 7, @primes[4..$#primes]); Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

STDIN Help

2001-09-24 Thread Yacketta, Ronald
Folks, I have the following little test code my $output = EOF Select the number of clients to run for this SLT: 1) 2000 2) 1500 3) 1300 4) 500 = EOF ; print $output; $num_clients = STDIN; how would I get the cursor to be on the same line as

Socket Connections TCP options associcated with them.

2001-09-24 Thread Kingsbury, Michael
Any ideas on how to set the TCP options on socket connections? setsockopts seems only to deal with the socket layer. -mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: STDIN Help

2001-09-24 Thread Morbus Iff
= EOF ; print $output; Instead of including your put text here arrow in your initial block, put it as part of output: my $output = EOF Select the number of clients to run for this SLT: 1) 2000 2) 1500 3) 1300 4) 500 EOF ; print $output =;

RE: STDIN Help

2001-09-24 Thread pconnolly
Option #1 ) my $output = EOF Select the number of clients to run for this SLT: 1) 2000 2) 1500 3) 1300 4) 500 = EOF ; chomp $output; print $output; $num_clients = STDIN; Option 2 ) print qq[ Select the number of

Re: Socket Connections TCP options associcated with them.

2001-09-24 Thread walter valenti
There's a packege Net::RawIP, to built packets TCP, UDP, ICMP, and capture packets (is a wrapper for libpcap). Work only on *nix system. Walter Any ideas on how to set the TCP options on socket connections? setsockopts seems only to deal with the socket layer. -mike -- To

Re: How many elements are there in a hash?

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (George S Pereira) wrote: I need to find out the number of elements in the hash. Is there any quick way, like $#array for arrays. the keys() function, in scalar context, returns the number of pairs in the hash.

Re: Inserting into the middle of arrays

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Walter Valenti) wrote: [original citation missing] How do I insert $scalar into position $x of @array, where $x is smaller than $#array? $array[$x]=$scalar; this replaces whatever was at index $x. to insert something you need to use

Re: going down an uncharted path

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED] m, [EMAIL PROTECTED] (Ronald Yacketta) wrote: Could someone point me to some examples? please, dont send the usual perldoc -f blah.. the company I am doing these scripts for does not have the perldoc installed there is always a way to get the perl

DBI error message

2001-09-24 Thread Danilov Dmitry
Hi ALL, I get pretty much all the time this error message when I try to connect to a remote MS SQL Server 2000 database. Anyone knows why this is happening and how to overcome it? Code looks like this #!/usr/bin/perl use DBI; my $dbh = DBI-connect (dbi:Sybase:mssql, 'test', 'test'); die Unable

RE: going down an uncharted path

2001-09-24 Thread Yacketta, Ronald
True.. but tis hard to view that page when the company has it filtered out via its proxy... why? only the twits who run the proxy know -Original Message- From: _brian_d_foy [mailto:[EMAIL PROTECTED]] Sent: Monday, September 24, 2001 12:12 To: [EMAIL PROTECTED] Subject: Re: going

Re: STDIN Help

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED] m, [EMAIL PROTECTED] (Ronald Yacketta) wrote: my $output = EOF Select the number of clients to run for this SLT: 1) 2000 2) 1500 3) 1300 4) 500 = EOF ; print $output; $num_clients = STDIN; how would

Re: How many elements are there in a hash?

2001-09-24 Thread _brian_d_foy
In article 2FB59B145095D511A7C90050BAC349F312DB@MAIL, [EMAIL PROTECTED] (John Edwards) wrote: $hash_length = scalar keys %hash; that's already in scalar context since you are assigning to a scalar. :) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ -

Re: global variables

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Ruth Albocher) wrote: I would like to use a global variable in my perl application, but since everything in perl is in a package, it will always belong to some package. what can I do? stay away from global variables. :) what are you trying

Re: global variables

2001-09-24 Thread _brian_d_foy
In article 001201c144fb$4a1ba3d0$ec00a8c0@boxx, [EMAIL PROTECTED] (Sascha Kersken) wrote: Perl 5.6 provides the 'our' statement as opposite to 'my': it makes a variable global to a file in which it's used. it declares a package variable, actually. if you aren't in its package, then you have

convert hexa to text

2001-09-24 Thread Hernan
Folks I need to know how can get to convert a hexadecimal string to text, there are some function or something, thanks!! sorry by my english hernan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: searching file for presence of ALL values of a hash when the hash key is the position of the value on the file's line

2001-09-24 Thread Michael Fowler
You have various problems with your code, one of which was already mentioned by Jos. I will mention it again, as well as point out the other problems. On Sat, Sep 22, 2001 at 06:22:01PM +0200, Birgit Kellner wrote: use strict; my (@hits, $key); my %hash = ('0' = 'miller', '1' = '32', '2' =

Re: Delete a line in a file

2001-09-24 Thread Michael Fowler
On Mon, Sep 24, 2001 at 03:24:26PM +0200, Jorge Goncalvez wrote: I would to delete the first 1001337334: dhcpd : DHCPOFFER on 192.40.54.41 to 00:b0:d0:23:80:67 via eth0 because it is repeated. perldoc -q 'line in a file' or http://www.perldoc.com/perl5.6.1/pod/perlfaq5.html second question.

RE: Perl by Example

2001-09-24 Thread John Moylan
I'd have to highly recommend Writing CGI Applications with Perl Could not agree more, the best intermediate Perl book around. (Is it meant to be intermediate Mr Author?) line by line code explaination, and useful programs too. The best absolute beginners book is Elements of programming Perl by

Re: Array of Hashes?

2001-09-24 Thread Richard J. Barbalace
Jonathan Batchelor writes: I have a data structure similar to the following: @hosts = ( list of hashes like below ... ); %hosts = ( name = hostname, ipaddr = www.xxx.yyy.zzz, location = location ); How can produce a sorted list of the hashes based on the

Re: Socket Connections TCP options associcated with them.

2001-09-24 Thread Michael Fowler
On Mon, Sep 24, 2001 at 11:20:10AM -0400, Kingsbury, Michael wrote: Any ideas on how to set the TCP options on socket connections? setsockopts seems only to deal with the socket layer. Generally, the Perl interface to TCP/IP is equivalent to the C interface. What would be the equivalent code

Re: convert hexa to text

2001-09-24 Thread rich+ml
If you mean that you have a string containing 61626364 and you want abcd: print pack a*, 61626364; On Mon, 24 Sep 2001, Hernan wrote: Date: Mon, 24 Sep 2001 13:50:52 -0400 From: Hernan [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Subject: convert hexa to text Folks I need

Re: Duplicate Modules

2001-09-24 Thread Michael Fowler
On Sat, Sep 22, 2001 at 05:06:46PM -0400, Kevin der Kinderen wrote: My method for downloading and installing might be a bit unconventional. I use 'perl -MCPAN -eshell' and the 'r' command to find updated modules. I then get the modules and install them manually. I've had problems in the

nohup'ing

2001-09-24 Thread Yacketta, Ronald
Folks, What would be the most efficient,easiest way to nohup a script from within perl? $file_to_run = nohup $filename ; exec ($filename); ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Array of Hashes?

2001-09-24 Thread Jeff 'japhy/Marillion' Pinyan
On Sep 24, Pete Sergeant said: @hosts = sort { %{$a}-{'name'} = %{$b}-{'name'} } @hosts; That (%{$x}-{key}) works for an ugly reason. It's probably a bug. @hosts = sort { $a-{name} cmp $b-{name} } @hosts; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI

RE: going down an uncharted path

2001-09-24 Thread Bob Showalter
-Original Message- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]] Sent: Monday, September 24, 2001 10:17 AM To: Beginners (E-mail) Subject: going down an uncharted path ...please, dont send the usual perldoc-f blah.. the company I am doing these scripts for does not have the

Certified in Perl?

2001-09-24 Thread patrick hall
Hi there, I'm wondering if there are any certification tests for Perl. I would just like to be able to put something on applications and resumes to let employers know I can do some Perl. Any ideas? Thanks! -Patrick Hall [EMAIL PROTECTED]

go with the flow

2001-09-24 Thread claement claementson
Dear all, This is my first post, so hello to everyone. Now time for my first ever question, which is a bit of a philisophical one. I have just started learning Perl in the last couple of weeks and have just finished my first bespoke program. It's quite involved (for me) and I have been having

Beginner needs help ...

2001-09-24 Thread Riggs, Joan
I am not a Perl programmer but I need help - does anyone do Unix Perl scripting that can assist me? I am sure it's pretty basic coding ... I need to parse out the /etc/group file to list all users and the groups they are in. thanks, JMRiggs

Re: Perl by Example

2001-09-24 Thread Kevin Meltzer
On Mon, Sep 24, 2001 at 06:14:36PM +0100, John Moylan ([EMAIL PROTECTED]) said something similar to: I'd have to highly recommend Writing CGI Applications with Perl Could not agree more, the best intermediate Perl book around. I love reading that! (Is it meant to be intermediate Mr

Re: go with the flow

2001-09-24 Thread Kevin Meltzer
Hi Claement, If you wish, you can post your code on the web somewhere and I am sure folks would be happy to review it and give some commentary on it. If you can not put it on the web (for whatever reason), please ask people to email you directly to get a copy (i.e. don't send it to the list :)

Re: Certified in Perl?

2001-09-24 Thread Bill Jones
On 9/24/2001 3:51 PM, patrick hall [EMAIL PROTECTED] wrote: applications and resumes to let employers know I can do some Perl. Any ideas? Write your resume in Perl; I did. And, if you don't believe it works in getting more interviews - it got me the job I have now :) Best; -Sx-

Re: Beginner needs help ...

2001-09-24 Thread Bill Jones
On 9/24/2001 4:00 PM, Riggs, Joan [EMAIL PROTECTED] wrote: I am not a Perl programmer but I need help - does anyone do Unix Perl scripting that can assist me? I am sure it's pretty basic coding ... I need to parse out the /etc/group file to list all users and the groups they are in.

Comparing two arrays in longest element order

2001-09-24 Thread Darin Weeks
Hi all, I am trying to compare two arrays for a macro building system. I need to start with the longest longest element from array 1 (the macros) and then compare it to all elements in array 2. If a match is found, I replace the match with '#0#' (replacing the number with the matching array

RE: Comparing two arrays in longest element order

2001-09-24 Thread Bob Showalter
-Original Message- From: Darin Weeks [mailto:[EMAIL PROTECTED]] Sent: Monday, September 24, 2001 4:31 PM To: [EMAIL PROTECTED] Subject: Comparing two arrays in longest element order Hi all, I am trying to compare two arrays for a macro building system. I need to start

line with nothing

2001-09-24 Thread COLLINEAU Franck FTRD/DMI/TAM
Hi! How can i repair (with a regular expression) a line with nothing inside ? Thanks Franck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Comparing two arrays in longest element order

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Darin Weeks) wrote: I am trying to compare two arrays for a macro building system. I need to start with the longest longest element from array 1 (the macros) and then compare it to all elements in array 2. Is there a simple way to cycle

Re: searching file for presence of ALL values of a hash when thehash key is the position of the value on the file's line

2001-09-24 Thread Birgit Kellner
Thanks a lot for the advice, Michael; I now got the code to work and am adding it further below, just for the record. --On Montag, 24. September 2001 09:07 -0800 Michael Fowler [EMAIL PROTECTED] wrote: my %hash = ('0' = 'miller', '1' = '32', '2' = 'copenhagen'); If you're indexing your

PPM

2001-09-24 Thread Russell Brooks
Hi, I realize that this may not be the correct forum. If it isn't, you have my sincere apologies. I had PPM working on an older build of Activestate, and needed to upgrade. Post upgrade PPM has stopped working. I've seen recommendations to migrate to build 620 or higher to fix PPM problems,

Re: go with the flow

2001-09-24 Thread claement claementson
Hi Kevin, That's great, thanks for your prompt and welcoming reply. I'm glad to be here. I have posted my script to http://www.5forty.com/perl/htmlcompiler.plx so if anyone has any time, I would be very grateful for any comments at all. I am a complete novice, so won't take any offense at all,

Re: Validating Array ref element in a hash of arrays

2001-09-24 Thread Peter Scott
At 05:04 PM 9/24/01 -0400, Kipp, James wrote: Hi I am the processing of writing a simple module and my brain just froze. I am trying to valide data that is being passed to the object constructor to make sure the arguments are acceptible. The args are being passed as named arguments. -- # hash of

Re: line with nothing

2001-09-24 Thread Bill Jones
On 9/24/01 10:53 AM, COLLINEAU Franck FTRD/DMI/TAM [EMAIL PROTECTED] wrote: How can i repair (with a regular expression) a line with nothing inside ? s//what/; ??? -Sx- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: remove last n elements from array and return the rest

2001-09-24 Thread Jeff 'japhy/Marillion' Pinyan
On Sep 25, birgit kellner said: Is there a simpler way than this to remove the last n elements of an array and to reassign same array to the remainder? You probably want to do: splice @array, 0, @array - 3; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI

Running a Perl Script from a Perl script

2001-09-24 Thread Daniel Falkenberg
List, This may seem like an odd questiong but to avoid race conditions I need to be able to run a Perl script from a Perl script (Ie execute it without any user interaction). Is this possbile. if (something = something) { RUN NEW PERL SCRIPT HERE THEN CONTINUE WITH THE PERL SCRIPT

Re: Running a Perl Script from a Perl script

2001-09-24 Thread Brett W. McCoy
On Tue, 25 Sep 2001, Daniel Falkenberg wrote: This may seem like an odd questiong but to avoid race conditions I need to be able to run a Perl script from a Perl script (Ie execute it without any user interaction). Is this possbile. if (something = something) { RUN NEW PERL SCRIPT

Re: Comparing two arrays in longest element order

2001-09-24 Thread _brian_d_foy
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Randal L. Schwartz) wrote: brian == brian d foy [EMAIL PROTECTED] writes: brian In article [EMAIL PROTECTED], brian [EMAIL PROTECTED] (Darin Weeks) wrote: brian you can use a schwartzian transform to pre-compute the lengths, brian then

Perl daemon and fork problems

2001-09-24 Thread Daniel Falkenberg
List, I have read and understood as much as I can about fork. But I have the following problem where I need to start up a second script in my first script. Problem is, if I have one already started as a deamon the second won't start as a deamon. Am I doing something terribly wrong here?

Sending command output to a file

2001-09-24 Thread Lance Martincich
Hi I am writing a script to automate a number of ufsdumps we do on our sun boxes. The script I am using works fine, however I wish to send the output of the ufsdump commands to a file and not display the output on the screen. The main reason is that this file will store other info pertaining