How to communicate with local ports

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi, My collegue is looking for a solution (Cpan module) to be able to communicate on a low level with for example a printer-port. He has designed a specific type of hardware, and needs to send signals to that port. Currently he is using C to do the work, but wants to rewrite it in Perl. Any adv

invisible syntax error

2002-06-11 Thread Adrian Farrell
hi, I simply wished to strip out all the ">" from a text file. below is the script and the error that is reported. I cannot see anything wrong, it's such a simple piece of code! can any one help, are my eyes deceiving me? thanks, Adrian #!/usr/bin/perl -w open(INPUT, "letter.txt") || die "c

invisible syntax error

2002-06-11 Thread Adrian Farrell
oops, ignore last mail, having one of those days, there was an accidental capitalization :} _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail:

Re: invisible syntax error

2002-06-11 Thread Tor Hildrum
> hi, > > I simply wished to strip out all the ">" from a text file. below is the > script and the error that is reported. I cannot see anything wrong, it's > such a simple piece of code! can any one help, are my eyes deceiving me? [localhost:~] tor% perl -e 'while(<>) {s/\>//g; print;}' >>

Re: invisible syntax error

2002-06-11 Thread Sudarsan Raghavan
> while (){ > if(S/\>//){ '>' does not have to be escaped (this is not an error, it is the capitalized s as you mentioned) You can just write this as s/>//. $_ = a>a>a>a>'; s/>//g; print "$_\n"; This prints -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: invisible syntax error

2002-06-11 Thread Connie Chan
- Original Message - From: "Adrian Farrell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 11, 2002 5:25 PM Subject: invisible syntax error > hi, > > I simply wished to strip out all the ">" from a text file. below is the > script and the error that is reported. I cann

Setting NT/Win2k networking params

2002-06-11 Thread Postman Pat
Greetings, Is there a CPAN module that I can use to set network settings for WinNT/2K such as WINS server, DNS server address, that kind of stuff. I am also looking for a pure perl way of setting the IP address, mask & gw. Currently I am using the command line tool netsh to do this. A pure pe

This is a test

2002-06-11 Thread phumes1
+---+ Philip Humeniuk [EMAIL PROTECTED] [EMAIL PROTECTED] ++ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

Outputting to screen and file.

2002-06-11 Thread phumes1
Hi, I have a Perl script that I need to modify. Presently, its outputting the results to the screen. Is there a way to also output the same to a file? +---+ Philip Humeniuk [EMAIL PROTECTED] [EMAIL PROTECTED] +--

RE: conf files

2002-06-11 Thread Langa Kentane
I recently played around with a module Config::General. Very handy. Try that. > -Original Message- > From: James Taylor [mailto:[EMAIL PROTECTED]] > Sent: 10 June 2002 08:27 PM > To: [EMAIL PROTECTED] > Subject: conf files > > > I have this app I just wrote, and I wanted to give my us

Re: Outputting to screen and file. (fwd)

2002-06-11 Thread Alan John Drew
-- Forwarded message -- Date: Tue, 11 Jun 2002 13:26:13 +0100 (BST) From: Alan John Drew <[EMAIL PROTECTED]> To: phumes1 <[EMAIL PROTECTED]> Subject: Re: Outputting to screen and file. You want to use something called tee. The following will open a pipe to $maxentpath (maxent i

Re: passing an empty string to a perl script via command line

2002-06-11 Thread Ramprasad A Padmanabhan
put your cmd-line arguments within quotes make sure they do not contain quotes themselves Bryan R Harris wrote: > Slightly OT, but does anyone know how to pass an empty string to a script > via the command line? I have a script that is invoked via: > >rename match-str replace-str > > ...

Re: Outputting to screen and file.

2002-06-11 Thread Ramprasad A Padmanabhan
run it on cmd-line with perl perscriptname.pl >outputfile Phumes1 wrote: > Hi, > > I have a Perl script that I need to modify. Presently, its outputting the > results to the screen. Is there a way to also > output the same to a file? > > > > >+---

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Anders Holm
And, for completeness: I'd think that it's not *nix that ignores the "", but rather Perl says that the variable that you assign the value to would then be undefined and just refuses to work with it. - use strict; should give you a warning about that. Best Regards Anders Holm Critical Path Tec

RE: Outputting to screen and file.

2002-06-11 Thread Nikola Janceski
if you are on UNIX there is a program called tee that outputs both to screen and file: perl perscriptname.pl | tee outputfile > -Original Message- > From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 8:41 AM > To: [EMAIL PROTECTED] > Subject: Re: Out

Re: Outputting to screen and file

2002-06-11 Thread phumes1
I tried the below but the output file was not created. The Perl script has open(STDOUT,"> NUL:); open(STDERR,"> NUL:); open(F,"> CON:); select(F);$|=1; . Should the code below be above or inside the "open"? Also, what does the line "select(F)..." do? > You want to use something call

Can you make it use one or more less vars?

2002-06-11 Thread Nikola Janceski
Can this be simplified with less variables? sub rcsname { my $file = shift; (my $rcsfile = $file) =~ s{somepattern}{andsubstitution}; return $rcsfile; } ### remember that the original arguement CANNOT be affected. Nikola Janceski I have great faith in fools; My friends call it self-confidence.

s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi, I am currently almost done with my current job. As I am reviewing my scripts the foreach-loop started to anoy me. I am afraid this is slowing down the script. Does anyone know a faster way to do the following : # -- open(FH, "< $groupfile"); @usrs = ; close FH; $htusr = (grep {/htuse

Putting values into hash

2002-06-11 Thread Anders Holm
Hi folks! Well, here's one I'm just not getting to grips with. I'm parsing a configuration file for an application, and it has a parameter as such: Parameter=Value1 Value2 Value3 \ Value4 Value5 Value6 \ Value7 Value8 There are other parameters before and after

Re: s/foreach/??/g

2002-06-11 Thread Sudarsan Raghavan
David vd Geer Inhuur tbv IPlib wrote: > Hi, > > I am currently almost done with my current job. > As I am reviewing my scripts the foreach-loop started to anoy me. > > I am afraid this is slowing down the script. Does anyone know a faster way to > do the following : > > # -- > open(FH, "< $gr

RE: Putting values into hash

2002-06-11 Thread Nikola Janceski
read the filein... open(FILE, $file) or die "blah blah $!"; undef $/; ## or local $/ if in a BLOCK $contents = ; close FILE; $contents =~ s/\\\n//g; # put everything on one line (deletes \ followed by newline) foreach (split /\n/, $contents){ ## you can figure this part out righ

Re: s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi Sudarsan, Sorry forgot to mention that : $pwuser = ($ENV{'REMOTE_USER'}); ## Apache var $groupfile is the group-file apache uses to authenticate. Unfortunetly there is no such thing as : $group = ($ENV{'REMOTE_GROUP'}); Therefor I have to open the file manualy and set it's $group

Re: Putting values into hash

2002-06-11 Thread Tor Hildrum
> read the filein... > > open(FILE, $file) or die "blah blah $!"; > undef $/; ## or local $/ if in a BLOCK > $contents = ; > close FILE; > > $contents =~ s/\\\n//g; # put everything on one line (deletes \ followed by > newline) > > foreach (split /\n/, $contents){ > ## you can figure this part

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Bob Showalter
> -Original Message- > From: Anders Holm [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 8:46 AM > To: Ramprasad A Padmanabhan; [EMAIL PROTECTED] > Subject: RE: passing an empty string to a perl script via command line > > > And, for completeness: > > I'd think that it's not *

Re: Can you make it use one or more less vars?

2002-06-11 Thread Jeff 'japhy' Pinyan
On Jun 11, Nikola Janceski said: >Can this be simplified with less variables? > >sub rcsname { >my $file = shift; >(my $rcsfile = $file) =~ s{somepattern}{andsubstitution}; >return $rcsfile; >} > >### remember that the original arguement CANNOT be affected. What makes you think that: sub rcsn

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Anders Holm
Hi Bob. Well, all I can now say is "DOH!". Oooppsie, my mistake.. ;) Too green on this yet.. Thanks for clearing up my confusions! Cheers! Best Regards Anders Holm Critical Path Technical Support Engineer -- Tel USA/Canada: 1

Re: s/foreach/??/g

2002-06-11 Thread Jeff 'japhy' Pinyan
On Jun 11, David vd Geer Inhuur tbv IPlib said: >open(FH, "< $groupfile"); >@usrs = ; >close FH; > > $htusr = (grep {/htuser: /} @usrs)[0] ; > $phi = (grep {/phil: /} @usrs)[0] ; > $al = (grep {/all: /} @usrs)[0] ; That looks wasteful to me. You're looping over the data FOUR[1] times, instead o

Re: s/foreach/??/g

2002-06-11 Thread Janek Schleicher
David Vd Geer Inhuur Tbv Iplib wrote at Tue, 11 Jun 2002 15:17:57 +0200: > Hi, > > I am currently almost done with my current job. > As I am reviewing my scripts the foreach-loop started to anoy me. It should not be the only thing, but let's talk about it later. > > I am afraid this is slowin

Re: s/foreach/??/g

2002-06-11 Thread Felix Geerinckx
on Tue, 11 Jun 2002 13:17:57 GMT, [EMAIL PROTECTED] (David Vd Geer Inhuur Tbv Iplib) wrote: > I am currently almost done with my current job. > As I am reviewing my scripts the foreach-loop started to anoy me. > > I am afraid this is slowing down the script. Does anyone know a > faster way to d

Re: s/foreach/??/g

2002-06-11 Thread Sudarsan Raghavan
David vd Geer Inhuur tbv IPlib wrote: > Hi Sudarsan, > > Sorry forgot to mention that : > > $pwuser = ($ENV{'REMOTE_USER'}); ## Apache var > > $groupfile is the group-file apache uses to authenticate. Unfortunetly there is > no such thing as : > > $group = ($ENV{'REMOTE_GROUP'}); > > The

Re: Outputting to screen and file.

2002-06-11 Thread Michael Lamertz
On Tue, Jun 11, 2002 at 07:58:15AM -0400, phumes1 wrote: > Hi, > > I have a Perl script that I need to modify. Presently, its outputting the > results to the screen. Is there a way to also > output the same to a file? Here's a possible solution you can use for starters: http://archive.devel

Re: Outputting to screen and file.

2002-06-11 Thread Michael Lamertz
On Tue, Jun 11, 2002 at 06:11:21PM +0530, Ramprasad A Padmanabhan wrote: > run it on cmd-line with >perl perscriptname.pl >outputfile That doesn't work since... > >results to the screen. Is there a way to also > >output the same to a file? he obviously want's to output to *both*, the sc

RE: Putting values into hash

2002-06-11 Thread Nikola Janceski
See inline comments: > -Original Message- > From: Tor Hildrum [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 12:01 PM > To: Perl > Subject: Re: Putting values into hash > > > > read the filein... > > > > open(FILE, $file) or die "blah blah $!"; > > undef $/; ## or local $/ i

Fwd: Re: Outputting to screen and file.

2002-06-11 Thread phumes1
Correct. I want to output to both but how? >Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm >List-Post: >List-Help: >List-Unsubscribe: >List-Subscribe: >Delivered-To: mailing list

Re: Outputting to screen and file.

2002-06-11 Thread Jenda Krynicky
From: phumes1 <[EMAIL PROTECTED]> > I have a Perl script that I need to modify. Presently, its outputting > the results to the screen. Is there a way to also output the same to a > file? You might want to try Ron Wantock's Local::TeeOutput ( http://jenda.krynicky.cz/perl/TeeOut

Re: Can you make it use one or more less vars?

2002-06-11 Thread Jenda Krynicky
From: Nikola Janceski <[EMAIL PROTECTED]> To: "Beginners (E-mail)" <[EMAIL PROTECTED]> Subject:Can you make it use one or more less vars? Date sent: Tue, 11 Jun 2002 09:17:38 -0400 > Can this be simplified with less variables? >

Re: Putting values into hash

2002-06-11 Thread drieux
On Tuesday, June 11, 2002, at 06:39 , Anders Holm wrote: [..] > I'm parsing a configuration file for an application, and it has a > parameter > as such: > > Parameter=Value1 Value2 Value3 \ > Value4 Value5 Value6 \ > Value7 Value8 > > There are other parameters before

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Jenda Krynicky
From: Bob Showalter <[EMAIL PROTECTED]> > The parsing of the command line and preparation of the argument list > is a function of the shell or command interpreter. Perl just takes the > argument list given to it via the execve() call. This is not true under Windows. There the pr

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Bob Showalter
> -Original Message- > From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 10:12 AM > To: [EMAIL PROTECTED] > Subject: RE: passing an empty string to a perl script via command line > > > From: Bob Showalter <[EMAIL PROTECTED]> > > The parsing of

error installing a module

2002-06-11 Thread Lance Prais
I am trying to install CGI.pm-3.01 on my Solaris 2.6 ultra 5 box. Below is the install process. I am not familiar with the error ""[test_dynamic] Error 29" It dose not appear to be fatal because if I force the install everything appears to be working correctly. In everything I have read rega

Re: passing an empty string to a perl script via command line

2002-06-11 Thread drieux
On Tuesday, June 11, 2002, at 07:12 , Jenda Krynicky wrote: > From: Bob Showalter <[EMAIL PROTECTED]> >> The parsing of the command line and preparation of the argument list >> is a function of the shell or command interpreter. Perl just takes the >> argument list given to it via

Thanks s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
I really have to thank you all !! I got so many replies, with hardcore answers. I need some time for that. But I really apreciate all of your excellent help ! Regs David One day, I hope to be as good as the best... One day.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Killing Idle Users

2002-06-11 Thread Akens, Anthony
Hello, I'm a sys-admin on an AIX (4.3) machine, and I'm trying to work with a vendor program that doesn't behave very nicely. Basically, if a user's connection to the server is inappropriately severed the application keeps right on chugging, leaving the user logged in. By inappropriately sever

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Bryan R Harris
Interesting! It looks like my problem comes from the way I'm reading arguments off the command line. I've been using: $match = shift || die("Usage: rename match-expr replace-expr [filenames] \n example: rename txt html *.txt\n"); $replace = shift || die("Usage: rename match-expr replace-e

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Bob Showalter
> -Original Message- > From: Bryan R Harris [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 11:50 AM > To: [EMAIL PROTECTED] > Subject: RE: passing an empty string to a perl script via command line > > > > Interesting! It looks like my problem comes from the way I'm reading >

About Image

2002-06-11 Thread Connie Chan
Hi all, I have the following code, which can port 1 image to browser, when I use Sambar Server for Win32 System. #!C:\perl\bin\perl.exe print "Content-type: image/jpeg\r\n\r\n"; $| = 1; open (FILE, 'C:/my/param/image.jpg'); binmode (FILE) ; binmode(STDOUT); while () { print $_ } close (FILE)

Checking environment variables...outputting to file

2002-06-11 Thread phumes1
Hi, I thought of another way possibly...of doing this. Is there a way through environment variables (or someother way) to check to see if the perl script is being run via command prompt or from a browser (web interface)? This way if someone runs the script from a command prompt I output it to

RE: passing an empty string to a perl script via command line

2002-06-11 Thread Bryan R Harris
Oh, thank you Bob! This has been annoying me since almost day 1 (almost 3 months now). You have lifted a great burden off my shoulders. I have a feeling I'm going to be polishing your car in the next life... =) - B __ > -Original Message- > From: Bryan R Harris [ma

windows, parameters and globbing (was Re: passing an empty string to a perl script via command line)

2002-06-11 Thread Jenda Krynicky
From: drieux <[EMAIL PROTECTED]> > On Tuesday, June 11, 2002, at 07:12 , Jenda Krynicky wrote: > > From: Bob Showalter <[EMAIL PROTECTED]> > >> The parsing of the command line and preparation of the argument > >> list is a function of the shell or command interpreter. Perl just > >>

Re: Checking environment variables...outputting to file

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi, There should be many ENV that would only be set if you are using a browser, but one of them might be HTTP_USER_AGENT. Here is a tested example : # if($ENV{'HTTP_USER_AGENT'}) { print "Content-type: text/html\n\n"; print " You are using a browser"; } else { print "You have started t

Fwd: Re: Checking environment variables...outputting to file

2002-06-11 Thread phumes1
Weird. I put the below lines in my perl script and ran it from the command prompt and from a web browser yet the results are telling me that "You have started this script from the command prompt" Why? Is the HTTP_USER_AGENT check not correct? >Date: Tue, 11 Jun 2002 18:35:16 +0200 (METDST)

Re: Checking environment variables...outputting to file

2002-06-11 Thread phumes1
Hang on...I have a batch file that is being executed. In the batch file contains my perl script that I'm executing so the below does work. If anyone is familiar with Allaire Cold FUsion I'm using the Hi, > >There should be many ENV that would only be set if you are using a >browser, but >one of

RE: Killing Idle Users

2002-06-11 Thread Todd_Hemsell
I am not in a position to offer advice but would love to see it . -Original Message- From: Akens, Anthony [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 10:48 AM To: [EMAIL PROTECTED] Subject: Killing Idle Users Hello, I'm a sys-admin on an AIX (4.3) machine, and I'm trying

RE: Killing Idle Users

2002-06-11 Thread Akens, Anthony
Here's the shell script, for those interested. Sorry for the lack of comments, but it's not to hard to figure out with a little patience... --- PTS=`w -l | grep pts | cut -c10-15` echo "" >> /home/danb/killemresults RIGHTNOWDATE=`date` echo $RIGHTNOWDATE >> /home/danb/killemresults echo

Re: Checking environment variables...outputting to file

2002-06-11 Thread drieux
On Tuesday, June 11, 2002, at 09:58 , phumes1 wrote: > Weird. > > I put the below lines in my perl script and ran it from the command > prompt and from a web browser yet the results are telling me > that "You have started this script from the command prompt" > > Why? > > Is the HTTP_USER_AGENT

RE: Killing Idle Users

2002-06-11 Thread David . Wagner
Here is the site for Dave Roth and his sys admin via Perl: http://www.roth.net/ Wags ;) -Original Message- From: Akens, Anthony [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 10:14 To: [EMAIL PROTECTED] Subject: RE: Killing Idle Users Here's the shell script,

Re: About Image

2002-06-11 Thread Jenda Krynicky
> I have the following code, which can port 1 image to browser, > when I use Sambar Server for Win32 System. > > > #!C:\perl\bin\perl.exe > > print "Content-type: image/jpeg\r\n\r\n"; > $| = 1; > open (FILE, 'C:/my/param/image.jpg'); > binmode (FILE) ; binmode(STDOUT); > while () { print $_ }

it works but is this right

2002-06-11 Thread A Taylor
howdy all, I was wondering if you could help me, I have a perl script that executes a SQL statement: 'SELECT prop_rank FROM main ORDER BY prop_rank DESC' This returns many records but all i am interested in is the highest rank hence the 'ORDER BY prop_rank DESC'. I then retreive the highest ra

Re: Checking environment variables...outputting to file

2002-06-11 Thread phumes1
OK...thanks for all the great examples but because I'm running either manually from a command prompt our from a batch file via web browser they are both being executed as a command prompt. This is how ColdFusion sees it. SoI have a batch file with the following line. Note: The runme.exe i

RE: Killing Idle Users

2002-06-11 Thread Craig Moynes/Markham/IBM
Something like this perhaps ?: #!/usr/bin/perl -w use strict; my $USER_IDLE = 40; my @input = qx!w -l!; shift @input; shift @input; foreach my $entry ( @input ) { my ($user, $port, undef, $idle) = split('\s+', $entry); if ( $idle =~ /^\d+$/ && $idle > 0 ) {

Re: it works but is this right

2002-06-11 Thread Christopher Solomon
On Tue, 11 Jun 2002, A Taylor wrote: > > $rank = $sth1->fetchrow_array(); > > Now, my question is this: is this the right way to retreive just 1 record, > using fetchrow_array(); ??? or is there a more acceptable way. This does > work, its just the 'array()' part is making me a little uneasy. >

Re: it works but is this right

2002-06-11 Thread Dave K
Uh,... no (atleast IMHO) SELECT MAX(prop_rank)... would be a more efficient approach HTH "A Taylor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > howdy all, > I was wondering if you could help me, I have a perl script that executes a > SQL statement: > > 'SELE

DBI data source for MS SQL server

2002-06-11 Thread learn perl
Hi folks, Need help with the connection data source for MS SQL server. Thanks Eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: DBI data source for MS SQL server

2002-06-11 Thread Joe Raube
What kind of help? What have you tried so far? What platform are you running Perl on? More info would be helpful... -Joe --- learn perl <[EMAIL PROTECTED]> wrote: > Hi folks, > > Need help with the connection data source for MS SQL server. > > Thanks > > Eric > > > -- > To unsubscribe, e-

FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread phumes1
Hi, How can fetch all the environment variables and print them to the screen? +---+ Philip Humeniuk [EMAIL PROTECTED] [EMAIL PROTECTED] +-

RE: Killing Idle Users

2002-06-11 Thread Akens, Anthony
Thanks! The only thing I saw to change was the line if ( $idle =~ /^\d+$/ && $idle > 0 ) to if ( $idle =~ /^\d+$/ && $idle > $USER_IDLE ) I'm going to do some testing to be safe, but will probably put this in place soon - and the great part is that I understand *most* of it! Tony Akens [EMAIL

Re: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread Jeff 'japhy' Pinyan
On Jun 11, phumes1 said: >How can fetch all the environment variables and print them to the screen? The %ENV hash holds all the environment variables. If you know how to use a hash, you can display all the environment variables. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.po

Re: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread phumes1
I have a problem...I don't know how to use a hash. :-( At 02:50 PM 6/11/2002 -0400, you wrote: >On Jun 11, phumes1 said: > > >How can fetch all the environment variables and print them to the screen? > >The %ENV hash holds all the environment variables. > >If you know how to use a hash, you can

DBI data source for MS SQL server

2002-06-11 Thread learn perl
Sorry, I got it already. I just need to know the standard connection string for ODBC connection. Eric On Tue, 11 Jun 2002, Joe Raube wrote: > What kind of help? What have you tried so far? > What platform are you running Perl on? > > More info would be helpful... > > -Joe > > --- learn perl <[

RE: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread Nikola Janceski
couldn't he do: my @allenv = map { [$_, $ENV{$_} ] } keys %ENV; local $" = "--"; foreach my $env (@allenv){ print "@{$env}\n"; } > -Original Message- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 2:50 PM > To: phumes1 > Cc: [EMAIL PROTECTE

RE: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread Felix Geerinckx
on Tue, 11 Jun 2002 18:57:46 GMT, Nikola Janceski wrote: > couldn't he do: > > my @allenv = map { [$_, $ENV{$_} ] } keys %ENV; > > local $" = "--"; > foreach my $env (@allenv){ > print "@{$env}\n"; > } Personally, I prefer print "$_--$ENV{$_}\n" for (keys %ENV); -- felix --

RE: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread phumes1
WHen I execute my script with the code below I get the following error: Missing $ on loop variable at runme.pl line 38. At 02:57 PM 6/11/2002 -0400, you wrote: >couldn't he do: > >my @allenv = map { [$_, $ENV{$_} ] } keys %ENV; > >local $" = "--"; >foreach my $env (@allenv){ > print "

RE: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread Jeff 'japhy' Pinyan
On Jun 11, Nikola Janceski said: >my @allenv = map { [$_, $ENV{$_} ] } keys %ENV; > >local $" = "--"; >foreach my $env (@allenv){ > print "@{$env}\n"; >} That's a lot of work, and Philip has said he doesn't know how to use a hash. for (sort keys %ENV) { print "$_ => '$ENV{$_}'\n";

Re: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread phumes1
Where can I learn about hashes? At 01:58 PM 6/11/2002 -0500, you wrote: >Don't ask a question like this again... What you should really be asking >is where you can learn about hashes. never ask someone to do your work >for you. Anyway, here... > >print "$_ is $ENV{$_}\n" for (sort keys %ENV); >

RE: Killing Idle Users

2002-06-11 Thread Akens, Anthony
Found another problem... The line my @inputP = qx!ps -e |grep $port!; is matching a bit overzealously... For instance, if $port = pts/6 it matches (and therefore would kill) not only processes on port pts/6, but also pts/61, pts/62 etc. Is there a better way to limit that? Tony Akens [EM

RE: FETCHING ENVIRONMENT VARIABLES

2002-06-11 Thread Nikola Janceski
"Don't count on me for thinking today." Something my PDE professor said once in class before midterms, and that's my condition this week. > -Original Message- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 3:08 PM > To: Nikola Janceski > Cc: phumes1

Re: it works but is this right

2002-06-11 Thread Michael Fowler
On Tue, Jun 11, 2002 at 05:49:53PM +, A Taylor wrote: > 'SELECT prop_rank FROM main ORDER BY prop_rank DESC' > > This returns many records but all i am interested in is the highest rank > hence the 'ORDER BY prop_rank DESC'. > I then retreive the highest rank like so: > > $rank = $sth1->fet

IP

2002-06-11 Thread Thiago Ferreira
Hi I need to control the access for some files in my httpd and I'd like to know if I can do this by knowing the IP of the computer that is requesting the file. If so, how? Thanks, Thiago.

RE: IP

2002-06-11 Thread James Kelty
Yes. If you are using Apache, you can just do it there. -James -Original Message- From: Thiago Ferreira [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 12:39 PM To: beginners-perl Subject: IP Hi I need to control the access for some files in my httpd and I'd like to know

Using Net::Telnet

2002-06-11 Thread Ken Hammer
Hi, I'm trying to use the Net::Telnet module to talk to a port a remote machine. There is an application on the remote machine (on a specific port) that takes a username/group as input and returns whether the user is a member of said group. No logging in is done at all. An example (done from the

Re: Killing Idle Users

2002-06-11 Thread David T-G
Tony -- ...and then Akens, Anthony said... % % Found another problem... % % The line % my @inputP = qx!ps -e |grep $port!; % is matching a bit overzealously... For instance, % if $port = pts/6 it matches (and therefore would kill) % not only processes on port pts/6, but also pts/61, pts/

RE: Killing Idle Users

2002-06-11 Thread Craig Moynes/Markham/IBM
So you noticed I didn't test in nearly enough :) try adding a -w to the grep for 'word grepping' (add it in both places), checking out the man page for grep may help. It was a fast hack job, it may be better to get a process list of the first, before the if statements, but I will leave that up t

chop off 1 white space?

2002-06-11 Thread Alaric Joseph Hammell
How would I get rid of one trailing white space character in $HASH{$key} and reassign the result OR how would I match a variable with 1 trailing white space to a variable that has no trailing white space character? Thanks, Al -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Placing Variable in "Open" function

2002-06-11 Thread Michael Norris
I'm trying to place a variable in the spot of an argument when exectuting a command with "open." Here's what I'm trying to do. open(COMMAND,"home/usr/usrname command $argument|"); while () print "$_"; #print output It's not accepting the $argument variable i'm putting in. __

RE: chop off 1 white space?

2002-06-11 Thread Shishir K. Singh
Is it only one Trailing white space or any trailing white space?? If any trailing white space , then you can do $HASH{$key} =~ s/\s+$//; If One ... $HASH{$key} =~ s/\s+$//; And then you can compare if ($HASH{$key} eq $myVariable) { } -Original Message- From: Alaric Joseph Ha

hidden stdin??

2002-06-11 Thread learn perl
Hi guys, I am writing a script where a user is prompted for password. However, I do not wish to have the program display his/her password. Is there a way to do this? here's my code #code begins# $i=-1; do{ $i++; print 'please enter password: '; chomp($input=); }until (!$i); #end co

RE: chop off 1 white space?

2002-06-11 Thread Shishir K. Singh
oopsfor one you do $HASH{$key} =~ s/\s$//; -Original Message- From: Shishir K. Singh Sent: Tuesday, June 11, 2002 4:31 PM To: Alaric Joseph Hammell; [EMAIL PROTECTED] Subject: RE: chop off 1 white space? Is it only one Trailing white space or any trailing white space?? If any

Re: chop off 1 white space?

2002-06-11 Thread Peter Scott
At 04:26 PM 6/11/02 -0400, Alaric Joseph Hammell wrote: >How would I get rid of one trailing white space character in >$HASH{$key} and reassign the result If you're certain that the last character is a space: chop $HASH{$key}; If it might not be a space, and you only want to get rid o

Re: hidden stdin??

2002-06-11 Thread Peter Scott
At 01:31 PM 6/11/02 -0700, learn perl wrote: >Hi guys, I am writing a script where a user is prompted for password. >However, I do not wish to have the program display his/her password. Is >there a way to do this? Yes, you type "perldoc -q password". Here's what happens: $ perldoc -q password

Re: chop off 1 white space?

2002-06-11 Thread Peter Scott
At 01:34 PM 6/11/02 -0700, I wrote: >At 04:26 PM 6/11/02 -0400, Alaric Joseph Hammell wrote: > >>How would I get rid of one trailing white space character in >>$HASH{$key} and reassign the result > >If you're certain that the last character is a space: > > chop $HASH{$key}; > >If it might

LWP post fails

2002-06-11 Thread bob ackerman
i am trying to login to DI-704 DLink router. i have python code that works. i want to do it in perl. the params below come from the python code. i get a 'Failed to login' when i run the code below. use LWP::UserAgent; my $ua = new LWP::UserAgent; my $req = HTTP::Request->new(POST => 'http://192.

Re: Placing Variable in "Open" function

2002-06-11 Thread Janek Schleicher
Michael Norris wrote at Tue, 11 Jun 2002 22:30:25 +0200: > I'm trying to place a variable in the spot of an argument when exectuting a command >with "open." > Here's what I'm trying to do. > > open(COMMAND,"home/usr/usrname command $argument|"); > while () > print "$_"; #print outpu

Re: chop off 1 white space?

2002-06-11 Thread Alaric Joseph Hammell
At 01:34 PM 6/11/02 -0700, I wrote: >At 04:26 PM 6/11/02 -0400, Alaric Joseph Hammell wrote: > >>How would I get rid of one trailing white space character in >>$HASH{$key} and reassign the result > >If you're certain that the last character is a space: > > chop $HASH{$key}; > >If it might

RE: chop off 1 white space?

2002-06-11 Thread Shishir K. Singh
^ -> Beginning o the string $ -> End of the string $myVar =~ s/^\s+//; -> Remove all Leading White Space $myVar =~ s/\s+$//; -> Remove all Trailing White Space What is your actual requirement ?? -Original Message- From: Alaric Joseph Hammell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, J

Re: Putting values into hash

2002-06-11 Thread Janek Schleicher
Anders Holm wrote at Tue, 11 Jun 2002 15:39:34 +0200: > Hi folks! > > Well, here's one I'm just not getting to grips with. > > I'm parsing a configuration file for an application, and it has a parameter as such: > > Parameter=Value1 Value2 Value3 \ > Value4 Value5 Value6 \ >

RE: chop off 1 white space?

2002-06-11 Thread Mark Anderson
> But, could someone explain the meaning of the "$" in the above expression, > s/\s$// . The $ looks for end of line/end of string. This is expression is saying take the whitespace character followed by end of line and replace it with nothing. If there is no whitespace character at the end of t

Re: hidden stdin??

2002-06-11 Thread Janek Schleicher
Learn Perl wrote at Tue, 11 Jun 2002 22:31:31 +0200: > Hi guys, I am writing a script where a user is prompted for password. However, I do >not wish to > have the program display his/her password. Is there a way to do this? > Have a look to the Term::ReadKey module. use Term::ReadKey; ReadM

installation problems with CPAN

2002-06-11 Thread Angshuman Guin
I am getting these kind of message when I'm trying to install some packages on my machine with Windows 2000 Professional on it. Could someone suggest any solutions. Thanks in advance -AG- cpan> install Tcl Running install for module Tcl Running make for M/MI/MICB/Tcl-b2.tar.gz Is already unwra

Re: LWP post fails

2002-06-11 Thread David T-G
Bob -- ...and then bob ackerman said... % % i am trying to login to DI-704 DLink router. Why was this in the "killing idle users" thread instead of in your "get external IP from D-Link router" thread? It makes it tough to follow what you're doing, not to mention distracting... It looks like y

Re: it works but is this right

2002-06-11 Thread A Taylor
thanks everyone - a lot of help and I have learned loads ;-) >SELECT MAX(prop_rank)... >"A Taylor" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > howdy all, > > I was wondering if you could help me, I have a perl script that executes >a > > SQL statement:

  1   2   >