Re: How does the $_ variable work?

2001-12-20 Thread Jeff 'japhy' Pinyan
On Dec 20, Beauty said: >I figure if I never ask anything, I'll never learn... >So here's my first post to the list. What is strict? Perl is a good language for laziness. What I mean by this is, unlike languages like C and Java, you can just use a variable whenever you want, and it will come in

Re: How does the $_ variable work?

2001-12-20 Thread Beauty
I figure if I never ask anything, I'll never learn... So here's my first post to the list. What is strict? I'm a newbie(think someone that only started programming ANYTHING a couple weeks ago) so try and stay simple. Thanks, -Kathryn --- Etienne Marcotte <[EMAIL PROTECTED]> wrote: > 1- Thanks f

Re[2]: Interpolate in Location:

2001-12-20 Thread K.L. Hayes
Hello Michael & List Members, Thanks for responding. Figured out the problem about 10 minutes after I sent the e-mail, turned out it was further up in the script where I assigned the value to this scaler. I know I got a bit escape-happy, but after banging my head on this for an hour I just start

Re: CPAN and Perl

2001-12-20 Thread Elaine -HFB- Ashton
Daniel Falkenberg [[EMAIL PROTECTED]] quoth: *>G'day All, *> *>I was just wondering if any one here has any experience with download *>Perl CPAN modules from a Perl script. I have looked at CPAN.pm but am a *>little confused by this. *> *>I have tried the following... *> *>#!/usr/bin/perl -w *> *

RE: Default variable for STDIN.

2001-12-20 Thread Gary Hawkins
Rather, use: if ($input =~ /^y$/i) unless you want "yellow" and "okay" to work too. > -Original Message- > From: Agustin Rivera [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 20, 2001 5:16 PM > To: Daniel Falkenberg; [EMAIL PROTECTED] > Subject: Re: Default variable f

Re: Default variable for STDIN.

2001-12-20 Thread Agustin Rivera
Easiest way is to do print "Hit Y to continue: [N]"; $input = ; if ($input =~ /y/i) {print "this way anything but Y or y will get ignored\n";} Also, if you just want Y and them to not have to hit ENTER, too, try using getc. Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com ---

RE: Default variable for STDIN.

2001-12-20 Thread Wagner-David
Just check like: chomp($input = ); # get input and remove the c/r $input = uc($input); if ( $input eq '' or $input eq 'N') { # nothing entered, so becomes your N # put what you want when default is entered } Wags ;) -Original Message--

Re: quick regex question

2001-12-20 Thread Chris Zampese
I tried the double brackets, but no luck :( Here is the code I use for my NET::SMTP, it seems to work OK for me using Windows 98. $server = '192.168.68.1'; #server name or ip address $from= "$INPUT{name}$INPUT{atsign}fbu-brokers.co.nz"; #just an email #address, but I get mine from the form $to=

RE: CPAN and Perl

2001-12-20 Thread McCollum, Frank
And to get the file, John Krahn submitted an example below earlier tonight sub get_games_file { use Fatal qw(open close); use LWP::Simple; use HTTP::Status; my $URL = 'http://www.mcn.net/~kenpom/cbbgames.txt'; my $gamefile = '/home/jeff/games/myfile.txt'; my $rc = mi

Default variable for STDIN.

2001-12-20 Thread Daniel Falkenberg
Hello All, Just a quick question. Just wondering how I would go about allowing a user to enter with STDIN either a Y or a N, but have the default variable of N if the user just hits enter. So far I have... print "Hit Y to continue: [N]"; $input = ; hmm.. something like that. Kind Regards, D

Re: quick regex question

2001-12-20 Thread Chris Zampese
Tried the double quotes, but then it ignores the $INPUT{field_name} altogether, I think maybe something to do with it being HTML, as I have had it going OK if I just have a simple text message like $mymessage='this is the field $INPUT{field_name}'; --- Chris Zampese <[EMAIL PROTECTED]> wrote: >

Re: quick regex question

2001-12-20 Thread Curtis Poe
--- Chris Zampese <[EMAIL PROTECTED]> wrote: > I have a program that takes input from a form, splits it and saves the values in an >array - > $INPUT{field} > I then create a NET::SMTP mail instance, and message is a string ($mymessage) in >which I have > inserted the form values. > This is so

Re: resetting foreach loops and @lists

2001-12-20 Thread John W. Krahn
"John W. Krahn" wrote: > > Try this example to see if it does what you want: > > #!/usr/bin/perl -w > use strict; > > my $count; > START: > for my $var ( 1 .. 4 ) { > print "$var "; > last if ++$count > 20; > goto START if $_ == 3; This line _should_ be: goto START if $var =

quick regex question

2001-12-20 Thread Chris Zampese
I have a program that takes input from a form, splits it and saves the values in an array - $INPUT{field} I then create a NET::SMTP mail instance, and message is a string ($mymessage) in which I have inserted the form values. This is so that I can create a form which when submitted will send a

Re: Finding Data Length

2001-12-20 Thread Curtis Poe
--- Prabhu Gurumurthy <[EMAIL PROTECTED]> wrote: > Hi All, > > I have a C program which i want to convert it into perl > In the C program it is given like this > > typedef unsigned shortu_int16; > #define dataLen 4 > #define keyLen52 > #define userke

How to set @INC

2001-12-20 Thread Pierre Carette
I have installed Active Perl on top of the regular Perl and now the @INC is not pointing to the right directories anymore. Is there a config file I can modify to fix that? Thanks a lot, Pierre -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Advice Wanted: authenticating users with perl

2001-12-20 Thread Daniel Gardner
Thursday, December 20, 2001, 11:04:44 PM, [EMAIL PROTECTED] wrote: > Okay, let me just start by saying that I'm only looking for advice and > triage. (In other words, I'm not asking you to do the work for me. Please > don't send nasty emails along the lines of "Use Google you moron." Done > that;

Finding Data Length

2001-12-20 Thread Prabhu Gurumurthy
Hi All, I have a C program which i want to convert it into perl In the C program it is given like this typedef unsigned short u_int16; #define dataLen 4 #define keyLen 52 #define userkeyLen 8 #define DataT(v) u_int16 v [dataLen] #define keyT(v) u_int16 v [keyLe

Re: CPAN and Perl

2001-12-20 Thread Daniel Gardner
Thursday, December 20, 2001, 11:20:35 PM, Daniel Falkenberg wrote: > I was just wondering if any one here has any experience with download > Perl CPAN modules from a Perl script. I have looked at CPAN.pm but am a > little confused by this. > I have tried the following... > #!/usr/bin/perl -w

Re: resetting foreach loops and @lists

2001-12-20 Thread Michael Fowler
On Thu, Dec 20, 2001 at 05:00:46PM -0500, Hanson, Robert wrote: > If you use "redo" while in that loop it will reset it and start over Just a bit of clarification: redo will not cause the loop to reset and start over. redo causes the current loop block to execute again, without re-evaluating the

Re: How to grab a file from web?

2001-12-20 Thread John W. Krahn
Jeff Self wrote: > > I'm trying to automate a process of grabbing a file from a website. I > could do a system call and use wget but I would like it to be as > portable as possible. Here's my function I've written so far: > > sub get_games_file() { > »···use LWP::Simple; > »··· > »··

Re: How to grab a file from web?

2001-12-20 Thread Daniel Gardner
Thursday, December 20, 2001, 9:34:29 PM, Jeff Self wrote: > I'm trying to automate a process of grabbing a file from a website. I > could do a system call and use wget but I would like it to be as > portable as possible. Here's my function I've written so far: > sub get_games_file() { > »···u

CPAN and Perl

2001-12-20 Thread Daniel Falkenberg
G'day All, I was just wondering if any one here has any experience with download Perl CPAN modules from a Perl script. I have looked at CPAN.pm but am a little confused by this. I have tried the following... #!/usr/bin/perl -w use strict; #Check if a module exists... if it doesn't then ask t

Re: Interfacing with Microsoft Access Database in win2k wiht ActiveSt ate Perl 5.6.01. General Help needed.

2001-12-20 Thread Clinton
No expert, this works for me. use strict; use DBI; my $dbHandle = DBI->connect('dbi:ODBC:(mydatabase - setup in control panel->odbc datasources)', '', '') || die $DBI::errstr; my $sql = "SELECT etc1, etc2 FROM tbletc WHERE etc = etc"; my $statementHandle = $dbHandle->prepare($sql); $statementHand

Re: resetting foreach loops and @lists

2001-12-20 Thread John W. Krahn
James Lum wrote: > > how do i reset a foreach loop so that it starts at the top each time? > > a sample of my code looks like: > > foreach $zrec (@file) # file with agent and city > { chomp($zrec); >foreach $zkey (@template) # put agent city data into hash >{ $hash{$z

Re: extract uptime for linux box w/perl

2001-12-20 Thread Daniel Gardner
Thursday, December 20, 2001, 4:02:00 AM, KeN ClarK wrote: > right now i do > w | head -1 > and get what's below my signature. I want to clean that up, cutting it > after the # of users, so that everything after AND including the third > comma is removed from that line. Then take that and add

Advice Wanted: authenticating users with perl

2001-12-20 Thread GoodleafJ
Okay, let me just start by saying that I'm only looking for advice and triage. (In other words, I'm not asking you to do the work for me. Please don't send nasty emails along the lines of "Use Google you moron." Done that; there's a lot out there.) So my big project for Jan is the following: Writ

Re: Interpolate in Location:

2001-12-20 Thread Michael Fowler
On Thu, Dec 20, 2001 at 04:33:57PM -0800, K.L. Hayes wrote: > > print "Location: >https://secure.whatever.com/business=email\@address.com\&item_name=Product+Name\&item_number=QX000\&amount=$total_amount\&shipping=0.00\&return=https://blah.com/ty.html\n\n";; > > > I'm trying to interpolate the

Re: Interpolate in Location:

2001-12-20 Thread Casey West
On Dec 20, 2001 at 04:33 -0800, K.L. Hayes took the soap box and proclaimed: : Hello All, : : Could somebody please help me with this? : : print "Location: :https://secure.whatever.com/business=email\@address.com\&item_name=Product+Name\&item_number=QX000\&amount=$total_amount\&shipping=0.00\&r

Re: Interfacing with Microsoft Access Database in win2k wiht ActiveSt ate Perl 5.6.01. General Help needed.

2001-12-20 Thread David Wall
[EMAIL PROTECTED] (Ryan Guy) wrote on 20 Dec 2001: > I am new to this. I was wondering what the best way to interface > with a Microsoft Access Database would be. I am going to be using > PerlScript to generate DHTML to make an online work-order system for > the IT department and the building e

RE: resetting foreach loops and @lists

2001-12-20 Thread Hanson, Robert
A foreach loop will always start at the first element and run to the last element. If you use "redo" while in that loop it will reset it and start over, and if you use last it will drop out of the loop. You only ever need to restart a loop if you are already in it. Maybe you could offer some s

RE: How to grab a file from web?

2001-12-20 Thread Hanson, Robert
You are on the right track, but get() won't give you an error if the page is not found. ...You might not need that though. Anyway I rewote your code a bit so that you can pass the URL to the sub, and save the page/data to a file. # I think this is what you were asking... use LWP::Simple; my $U

Interpolate in Location:

2001-12-20 Thread K.L. Hayes
Hello All, Could somebody please help me with this? print "Location: https://secure.whatever.com/business=email\@address.com\&item_name=Product+Name\&item_number=QX000\&amount=$total_amount\&shipping=0.00\&return=https://blah.com/ty.html\n\n";; I'm trying to interpolate the $total_amount in

How to grab a file from web?

2001-12-20 Thread Jeff Self
I'm trying to automate a process of grabbing a file from a website. I could do a system call and use wget but I would like it to be as portable as possible. Here's my function I've written so far: sub get_games_file() { »···use LWP::Simple; »··· »···my $URL = 'http://www.mcn.net/~kenp

resetting foreach loops and @lists

2001-12-20 Thread James Lum
hi, how do i reset a foreach loop so that it starts at the top each time? a sample of my code looks like: foreach $zrec (@file) # file with agent and city { chomp($zrec); foreach $zkey (@template) # put agent city data into hash { $hash{$zkey},$zrec)=split(/\//,$zrec,2);

RE: Searching a string?

2001-12-20 Thread Hanson, Robert
The perlre manpage is a good place to start: http://www.perldoc.com/perl5.6.1/pod/perlre.html Or if you want a full view of regexes I recommend the Mastering Regular Expressions book from O'Reilly. Rob -Original Message- From: Batchelor, Scott [mailto:[EMAIL PROTECTED]] Sent: Thursd

Re: Searching a string?

2001-12-20 Thread Jeff 'japhy' Pinyan
On Dec 20, Batchelor, Scott said: >1. I am trying to not allow doubled numbers or symbols(e.g. 99 or %%) To ensure a character is not immediately repeated, do !/([^A-Za-z])\1/ That means "not matching 'a non-alpha followed by itself'". >2. Also want to make it so the password has at

RE: Searching a string?

2001-12-20 Thread Batchelor, Scott
Anywhere I can read up...to find out exactly what is going on in these scripts? I really appreciate the help both of you have given here. Thanks Scott M. Batchelor | [EMAIL PROTECTED] IT Policy Office - OVPIT| voice: (812) 855-6346 Indiana Univ

RE: Searching a string?

2001-12-20 Thread Wagner-David
Here is a shot. I am not regex so I was not able to do a single regex for the double characters, why I am pretty sure could be done, but not by me. You need to pull my $MyCnt ; my %MyCnts = (); while ( 1 ) { printf "Please enter password:"; chomp(my $MyPasswd = ); last if ( $My

Re: Compress::Zlib and .Z files dont work !!

2001-12-20 Thread Michael Fowler
On Thu, Dec 20, 2001 at 03:25:27PM -0200, Gregory wrote: > Hi i have a .Z file generated by compress and i need read this file in a > Perl script. > I install the Compress::Zlib to do this, but the samples of Compress::Zlib > dont work !! The problem is very likely your usage of the gz* functio

Re: HTML::Treebuilder

2001-12-20 Thread Michael Fowler
On Wed, Dec 19, 2001 at 05:46:15PM -0500, McCollum, Frank wrote: > I do not understand what is meant by 'depth' in this module (i've read the > accompanying documentation, but I didn't follow it well). Does anyone know > where a good description is? The HTML::Element documentation has an intro

RE: Searching a string?

2001-12-20 Thread Wagner-David
I tried abb3456djfuh and it never objected. Wags ;) -Original Message- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 12:18 To: Wagner-David; 'Batchelor, Scott'; '[EMAIL PROTECTED]' Subject: RE: Searching a string? Oops, chang it to this... #

RE: Searching a string?

2001-12-20 Thread Hanson, Robert
Oops, chang it to this... # reject double nums/symbols if ( $password =~ /([^a-zA-Z])\1/ ) { return "Double numbers or symbols"; } Rob -Original Message- From: Wagner-David [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 3:03 PM To: Hanson, Robert; 'Batchelor, Scot

RE: Interfacing with Microsoft Access Database in win2k wiht ActiveSt ate Perl 5.6.01. General Help needed.

2001-12-20 Thread Chris Spurgeon
Funny, I asked that exact question about a month or two ago. What I was told, and what worked just fine for me, was to use the general DBI module along with the more specific DBD::OBDC module. That combo let's you connect to OBDC compliant DBs, such as MS Access. Chris Spur

RE: Searching a string?

2001-12-20 Thread Wagner-David
He didn't want double digits TOGETHER(ie, 99 is invalid and 98 would be valid) That is the way I read the email request. Wags ;) -Original Message- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 12:02 To: 'Batchelor, Scott'; '[EMAIL PROTECTED]'

RE: Searching a string?

2001-12-20 Thread Hanson, Robert
Try this out, it seems to work ok. my @passwords = ("12threefour", "5six7eight", "9ten9ten9ten", "number1"); for ( @passwords ) { my $error = checkPass($_); print ( ($error) ? "$error\n" : "Good pass!\n" ); } sub checkPass { my $password = shift; # rejec

Interfacing with Microsoft Access Database in win2k wiht ActiveState Perl 5.6.01. General Help needed.

2001-12-20 Thread Ryan Guy
I am new to this. I was wondering what the best way to interface with a Microsoft Access Database would be. I am going to be using PerlScript to generate DHTML to make an online work-order system for the IT department and the building engineers. I just wanted to ask for a small example or two o

Re: Learning Perl, chapter 8: pattern_test

2001-12-20 Thread Michael Fowler
On Thu, Dec 20, 2001 at 11:22:16AM +0800, Leon wrote: > Coming to the point, put qutoes on 'i am fred flintstone' and thats what > you want; like this :- > while ( < 'i am fred flintstone' >) > > -- results I got from your script after putting quotes --- > matched: |i am | So you're sugg

RE: how to print

2001-12-20 Thread Hanson, Robert
No, that can't be done... at least not from a CGI script. You can only trigger printing on the client end of things and not the server end. About the best you could do is use some JavaScript in the page to open up the print dialog, but it won't automatically print. You could also run PerlScr

Re: how to print

2001-12-20 Thread Jerry Preston
Hi, The user's will be using PC's running NT 4.0 when running the scripts. Thanks Again for Your HELP!! Jerry Jerry Preston wrote: > Hi, > > I am using Perl with CGI on a SUN box. I want to be able to send to the > local user running my script a report directly to their printer. What > is i

how to print

2001-12-20 Thread Jerry Preston
Hi, I am using Perl with CGI on a SUN box. I want to be able to send to the local user running my script a report directly to their printer. What is involved? What does Perl have to support this? Thanks, Jerry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

RE: Counting the size of an array reference

2001-12-20 Thread Gibbs Tanton - tgibbs
$#{ $MyArray } will give you the position of the last element. -Original Message- From: Tomasi, Chuck To: '[EMAIL PROTECTED]' Sent: 12/20/2001 10:01 AM Subject: Counting the size of an array reference For a normal array (@MyArray), one can use $#MyArray to get the position of the last e

RE: Counting the size of an array reference

2001-12-20 Thread Bob Showalter
> -Original Message- > From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 20, 2001 11:02 AM > To: '[EMAIL PROTECTED]' > Subject: Counting the size of an array reference > > > For a normal array (@MyArray), one can use $#MyArray to get > the position of > the last

RE: Shift question...

2001-12-20 Thread Bob Showalter
> -Original Message- > From: Wim De Hul [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 20, 2001 10:48 AM > To: [EMAIL PROTECTED] > Subject: Shift question... > > > Hello guys ( and girls), > > While I was reading a script, I saw the lines: > > my $var = shift; > > I thought tha

RE: browser commands....

2001-12-20 Thread Bob Showalter
> -Original Message- > From: Mark Mclogan [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 19, 2001 10:08 AM > To: [EMAIL PROTECTED] > Subject: browser commands > > > > > Hi! again. > > As I can insert browser commands in script in Perl. For > example, if I want > to return

Re: HTML to text

2001-12-20 Thread Curtis Poe
--- "McCollum, Frank" <[EMAIL PROTECTED]> wrote: > Does anyone know where to find resources on parsing textual content out of > an HTML page? I am trying to grab values out of a table on a website. I > can grab the table, but I am having trouble grabbing the actual values from > it... Frank, Y

HTML to text

2001-12-20 Thread McCollum, Frank
Does anyone know where to find resources on parsing textual content out of an HTML page? I am trying to grab values out of a table on a website. I can grab the table, but I am having trouble grabbing the actual values from it... Thanks Frank McCollum Bank Of America Securities, LLC [EMAIL PROT

Re: help with DBD error

2001-12-20 Thread Maxim Berlin
Hello JIM-CONT, Thursday, December 20, 2001, FLAHERTY, JIM-CONT <[EMAIL PROTECTED]> wrote: FJC> hello, I have redhat 7.1 and perl is loaded with mysql , I have several FJC> scripts with perl , DBI, DBD and mysql working fine , so If think I have FJC> everything set up properly FJC> But I get

Weekly list FAQ posting

2001-12-20 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address)

Compress::Zlib and .Z files dont work !!

2001-12-20 Thread Gregory
Hi i have a .Z file generated by compress and i need read this file in a Perl script. I install the Compress::Zlib to do this, but the samples of Compress::Zlib dont work !! The example work like a 'cat file.Z' not a zcat. What is wrong ?? Any body have a sample ??? Sorry the bad English

help with DBD error

2001-12-20 Thread FLAHERTY, JIM-CONT
hello, I have redhat 7.1 and perl is loaded with mysql , I have several scripts with perl , DBI, DBD and mysql working fine , so If think I have everything set up properly But I get an error : DBD::mysql::st execute failed: Duplicate entry '204' for key 1 at /var/www/cgi-b in/sobt/chstat

Re: STDIN

2001-12-20 Thread Curtis Poe
--- walter valenti <[EMAIL PROTECTED]> wrote: > Hi, > someone knows, how insert text gron STDIN, without see this on the > shell?? > > For example for insert a password.. Walter, I *think* what you are asking is "How do I get a password from STDIN without it showing up on the screen?" use

RE: Counting the size of an array reference

2001-12-20 Thread John Edwards
Or, better still sub MySub { my ($aref)=@_; $count = $#{$aref}; return $count; } John -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:02 To: '[EMAIL PROTECTED]' Subject: Counting the size of an array reference

RE: Counting the size of an array reference

2001-12-20 Thread John Edwards
How about sub MySub { my ($aref)=@_; $count = @{$aref}; return $count - 1; } HTH John -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:02 To: '[EMAIL PROTECTED]' Subject: Counting the size of an array reference

Re: Shift question...

2001-12-20 Thread Michael Stidham
The way I understand it Shift removes the first element of the list and moves (or "shifts") every remaining element of the list to the left to cover the gap. Shift then returns the removed element.ex:) @list = qw(1,2,3); $fisrtval = shift(@list); Hope this helped...Stiddy >From: Wim De Hul

STDIN

2001-12-20 Thread walter valenti
Hi, someone knows, how insert text gron STDIN, without see this on the shell?? For example for insert a password.. Thanks Walter †(¹†¡¢ž·*.­úÞ{&¡¢‡(™§]­ë,jØm¶Ÿÿ™¨¥É¨h¡Ê&

Re[2]: Data through the parallel port

2001-12-20 Thread Maxim Berlin
Hello Stanislav, Thursday, December 20, 2001, Stanislav Zahariev <[EMAIL PROTECTED]> wrote: >> hi. >> in last month , i send data through port but not with laser. >> i am working in ISP and send and receive data through port >> and routhr. SZ> So, how ? :)) With perl or without? I can manage it

Counting the size of an array reference

2001-12-20 Thread Tomasi, Chuck
For a normal array (@MyArray), one can use $#MyArray to get the position of the last element. So, if I'm given $MyArrayRef, how does one do the same operation to find out how many things are in MyArrayRef? Ex: sub MySub { my ($aref)=@_; return(__); } my @MyArray = (0,

Re: Data through the parallel port

2001-12-20 Thread Papo Napolitano
I don't know of a module... But I managed to use the parallel port to detect a button push with plain old Perl code =) Here's a snippet: sysopen IOPORT, "/dev/port", O_RDONLY; # Open LPT Port sysseek IOPORT, 889, 0 or die "sysseek() failed: $!\n"; # Select Port 0x379 $nstatus = sysread IOPORT, $s

RE: Shift question...

2001-12-20 Thread John Edwards
shift returns the first value of the array. When no array is defined it operates on the default array @_ You will most likely see the line you mention as the first line of a subroutine. E.g &call_sub('John'); sub call_sub { my $name = shift; print "Name is $name\n"; } What's ha

Re: I need your help

2001-12-20 Thread Shawn
Hey Jose, The open file is a basic concept that should be easy to pick up. I will give you the fish, and maybe someone else will be kind enough to teach you how via perldoc (I still am lost in the internal docs)... my $new_file; open(FILE,') { $line=~s/WORD_TO_REPLACE/REPLACEMENT_WORD/g; $

Shift question...

2001-12-20 Thread Wim De Hul
Hello guys ( and girls), While I was reading a script, I saw the lines: my $var = shift; I thought that shift puts a variable in an array? What does this mean? Thanks, Wim. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: I need your help

2001-12-20 Thread John Edwards
That can be viewed as two problems with the same answer. When you find word1, replace with your new word. When you find word2, replace with nothing, hence deleting it. Tip, look up docs on the s/// or substitute method HTH John -Original Message- From: Jose Vicente [mailto:[EMAIL PROTE

I need your help

2001-12-20 Thread Jose Vicente
Hi. I am trying two items in a script: - I have to read a file and when I find certain word I must change it for other one. - I have to read a file and when I find certain word I must delete it from the file and all the ocurrences. Thanks for your help. -- To unsubscribe, e-mail: [EMAIL

Re: Is there a real person in charge of this list?

2001-12-20 Thread Kevin Meltzer
These requests should be sent to [EMAIL PROTECTED] Also, please make sure you have tried all the ways to unsubscribe which are shown in the FAQ, as well as the tool on the http://learn.perl.org website. Cheers, Kevin On Thu, Dec 20, 2001 at 02:04:19PM -, Watkiss, Stewart ([EMAIL PROTECTED])

Re: extract uptime for linux box w/perl

2001-12-20 Thread Jim Conner
At 08:28 12.20.2001 -0500, Kevin Meltzer wrote: >Am I just the overly paranoid one? But IMO doing this can be dangerous. >Tainting isn't just for CGIs, and adding a -T to this shows it can be >dangerous ($ENV{PATH} issue, since you don't really know what uptime you will >end up calling). Again, I

Is there a real person in charge of this list?

2001-12-20 Thread Watkiss, Stewart
Hello, I've tried to unsubscribe from this list as I am unable to keep up with the amount of traffic (and it's causing me to hit my email storage limits). However everytime I try to use the listserver unsubscribe process it fails due to either outlook or my companies email servers stripping some

Re: extract uptime for linux box w/perl

2001-12-20 Thread Jim Conner
At 11:06 12.20.2001 +0200, Stef wrote: >Damn if you're gonna do it this way , why not just do: >uptime > >Thus spake John W. Krahn on 20-Dec-2001 : >-> perl -le'print join",",(split/,/,`uptime`)[0..2]' I love Perl :") - Jim >~~~ >E-Mail: Stef <[EMAIL PROTECTE

Re: extract uptime for linux box w/perl

2001-12-20 Thread Kevin Meltzer
Am I just the overly paranoid one? But IMO doing this can be dangerous. Tainting isn't just for CGIs, and adding a -T to this shows it can be dangerous ($ENV{PATH} issue, since you don't really know what uptime you will end up calling). Again, I may be the overly-paranoid (read safe) one :) Cheer

Re: Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread Shawn
He Brian, In Perl, you don't have to declare your variables if you don't want to. You are building the count hash on the fly here. All you are doing is incrementing itself by one everytime the word is found. @words=('test','this','that','test'); for $word (@words) { $count{$word}=$count{$wor

RE: Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread John Edwards
I'll try $count {$word} = $count {$word} + 1; The $count refers to a hash called %count. As you are working with only one element of that hash (the key/value pair with the key of $word), you reference the element as a scalar (hence the $, not %). It's still refering to the hash, but not the whol

test

2001-12-20 Thread Christo Rademyer
test.

Re: FW: Question

2001-12-20 Thread Jerry Preston
Pankaj, What I did was to make the background display area larger and then write the info to that area.   my $back_ground = 800;   my $image = new GD::Image( $back_ground + 660, $back_ground + 130 ); Jerry Pankaj Warade wrote:   -Original Message- From: Pankaj Warade [mailto:[EMAIL PROT

Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread Brian_Blake
Hi there, Very new to PERL (chapter 5 Learning PERL edition 2!!) but I am determined to master this!! Or at least be good at it!! I'm having trouble grasping the code below. I know it's a small snippet but I think it's important. Can you please explain the $count variable and how the %count cam

Re: Replace

2001-12-20 Thread Andrea Holstein
Shawn wrote: > > > If speed is important, it's good to avoid capturing. > > so $string =~ s/(\w+)_(?:NN|IN|AT)/$1/g; is quicker. > > Is there a big time savings since there is a capture anyway? > It can't be said in generally. It depends on the input and the perl version. But at least, it's alw

Re: browser commands....

2001-12-20 Thread Andrea Holstein
Mark McLogan wrote: > > Hi! again. > > As I can insert browser commands in script in Perl. For example, if I want > to return to my previous web page (back) > > Thanks all! Sorry, but what's your question ? I only can find two statements. Did you mean, you want user's browser to go back to the

Re: Replace

2001-12-20 Thread Shawn
> Shawn wrote: > > > > I think this is what you are asking for... > > > > $string=s/(\w+)_(NN|IN|AT)/$1/g; > > $string=''.$string.''; > > > > Shawn > > I believe, there's a typo :-) > $string =~ s/(\w+)_(NN|IN|AT)/$1/g; > ^ D'OH! Thanks Andrea :-) > > If speed is important, it's g

Re: Replace

2001-12-20 Thread Andrea Holstein
Shawn wrote: > > I think this is what you are asking for... > > $string=s/(\w+)_(NN|IN|AT)/$1/g; > $string=''.$string.''; > > Shawn I believe, there's a typo :-) $string =~ s/(\w+)_(NN|IN|AT)/$1/g; ^ If speed is important, it's good to avoid capturing. so $string =~ s/(\w+)_(?:NN|IN|

RE: extract uptime for linux box w/perl

2001-12-20 Thread Steven Hetland
> -Original Message- > > right now i do > > w | head -1 > > and get what's below my signature. I want to clean that up, cutting it > after the # of users, so that everything after AND including the third > comma is removed from that line. Then take that and add it to my > signature > scrip

Re: Learning Perl, chapter 8: pattern_test

2001-12-20 Thread Peter Cornelius
Like Michael Fowler wrote, the angle operators, when used like this, glob file names. But since you don't have any special patterns it's just returning the list of filenames from inside the '<' and '>'. If you do a print "$_\n"; inside the while loop you'll see that the strings hitting the

Re: Data through the parallel port

2001-12-20 Thread Jon Molin
Hi Stanislav i searched with google for Device::ParallelPort and came up with this: http:[EMAIL PROTECTED]/msg05952.html i was too lazy to register at https://pause.perl.org/pause/authenquery?ACTION=edit_mod as the post requests though, might be something for you? It'd be nice to hear about y

Re: extract uptime for linux box w/perl

2001-12-20 Thread Stef
Damn if you're gonna do it this way , why not just do: uptime Thus spake John W. Krahn on 20-Dec-2001 : -> perl -le'print join",",(split/,/,`uptime`)[0..2]' ~~~ E-Mail: Stef <[EMAIL PROTECTED]> Date:20-Dec-2001 Time:11:05:43 XFMail

Re: extract uptime for linux box w/perl

2001-12-20 Thread John W. Krahn
Jim Conner wrote: > > At 02:01 12.20.2001 -0500, Jim Conner wrote: > > > >At 00:26 12.20.2001 -0500, Steven Hetland wrote: > > > > > >There's probably a bazillion ways to accomplish this, but here's two ways: > > > > > >Example 1: > > >-- > > >chomp($uptime = `uptime`); > > >$uptime =~ s/

Re: Data through the parallel port

2001-12-20 Thread nafiseh saberi
hi again. in my work data transfer with tcp/ip protocol or through lan. not with port... and if you want to build one device that connect to parallel port of computer and then start transfer data .. you must work on socket programming with perl. i am sure that it is possible with perl. I work wit