Forking in NT

2002-02-13 Thread srinivas krish
Hi!, I have to make a platform independent script that will start a server and client in the script. I attempted this using fork method. Although the script runs well in UNIX, it does not run on Nt - giving the error: The process cannot access the file because it is being used by another process.

Generating for loop paterns HELP!

2002-02-13 Thread Bruce Ambraal
Hi I have done (b) for coding see below, could someone assist with (a) (b) (d) #!/usr/local/bin/perl -w my $num_rows; my $i; my $r; $num_rows = ; for ($r = 1; $r <= $num_rows; $r++) { for ($i=1; $i<= $r; $i++) {print (" \n");} for ($i = $num_rows + 1 - $r;$i>=1; $i--){ pr

Re: downloading a file

2002-02-13 Thread Tanton Gibbs
Never mind...LWP::UserAgent 's get method allows you to give a filename to download to...that is sooo cool!!! - Original Message - From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 14, 2002 2:08 AM Subject: downloading a file > There is a .zip file

downloading a file

2002-02-13 Thread Tanton Gibbs
There is a .zip file on a webpage that I want to download from a perl script. I'm running Windows 98. I know the name of the file, but I have no idea how I would go about downloading the file (it is an http page, not an ftpable file). Thanks for any help! Tanton -- To unsubscribe, e-mail: [E

Help can't figure this one out

2002-02-13 Thread Bruce Ambraal
I have written following coding to produce a triangle pattern(see below); I now want to produce following paterns I can't figer this out (a)(b) (c) (d) diamond ** * * * * * * * * *

Re: Sites

2002-02-13 Thread Ahmed Moustafa
Naveen, take a look at http://arbornet.org/. I think it's what you are looking for. Good luck Naveen Parmar wrote: > Any recommendations on free Web sites where you may upload Perl scripts > and execute CGI scripts? > > TIA, > - NP -- Ahmed Moustafa [EMAIL PROTECTED] | http://pobox.com/~am

HTML::

2002-02-13 Thread Daniel Falkenberg
t -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Array question

2002-02-13 Thread Kevin Butters
You and Mike showed me my error. I placed a 1 in the length field. It was inserting the element member I wanted but also removing one. Thanks, K --- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Tue, 12 Feb 2002, Michael Fowler wrote: > > > Consider: > > > > @week = qw(Monday Wednesday Fr

Re: foreach loop problems

2002-02-13 Thread dan radom
I've set SSH_AUTH_SOCK and SSH_AGENT_PID environment variables so the script can run from cron, but there is no password prompt with ssh-agent and hostkey authentication. an * Johnathan Kupferer ([EMAIL PROTECTED]) wrote: > I was actually surprised to see that ssh worked like this! I don't >

Re: [PHP] Browse and Upload file

2002-02-13 Thread James Taylor
Oh Jesus, I'm on too many mailing lists. Ignore this On Wednesday 13 February 2002 05:44 pm, you wrote: > There are scripts like this all over the net, but here's one for you to > save you searching time: > > use CGI qw(:standard); > > $| = 1; > $i=param('fileuploadname'); > > open(OUTPUT, ">/li

Re: [PHP] Browse and Upload file

2002-02-13 Thread James Taylor
There are scripts like this all over the net, but here's one for you to save you searching time: use CGI qw(:standard); $| = 1; $i=param('fileuploadname'); open(OUTPUT, ">/lists/$i") or die "cannot find output: $!"; while ($bytes = read($i,$buffer,1024)) { $bytesread += $bytes; print OU

print stock market page every so often

2002-02-13 Thread Peter Lemus
hi guys, just wondering if I can use perl to email me a text based copy of a web page, maybe copy and paste to a file then e-mail the info. I can probably use something like a macro in windows nt to create a procedure or somethingany ideas? thanks...maybe someone has done this before. I woul

Re: Text Files...

2002-02-13 Thread John W. Krahn
Deniz hepþen wrote: > > Hi, Hello, > I want to do a parse fonction which reads prices.txt. My prices.txt file is like > > 20::30::1 > 3::2::7 > > When i want to see for example "2", i want to type "print "$x[1][1]";" > Why this function below is false? #!/usr/bin/perl -w use stric

Re: array question and ODBC note

2002-02-13 Thread Michael Fowler
On Wed, Feb 13, 2002 at 01:14:50PM -0800, John wrote: > Recently someone pointed out that it's better to use: > > while( defined( my $line = )) > > than > > while( my $line = ) In more recent versions of Perl (5.00503 and above) there is no need to wrap a defined around this specific loopin

Text Files...

2002-02-13 Thread Deniz Hepşen
Hi, I want to do a parse fonction which reads prices.txt. My prices.txt file is like 20::30::1 3::2::7 When i want to see for example "2", i want to type "print "$x[1][1]";" Why this function below is false? thanx sub parse { open (PRICES , "; clo

Re: octal file permissions

2002-02-13 Thread Michael Fowler
On Wed, Feb 13, 2002 at 05:20:38PM -0500, zentara wrote: > Ok, I can understand that because 33088 = oct(100500) > but given the octal number 33088 what function do I use > to convert it to 100500? In other words what is the > procedure to do octal to decimal conversion? You have it backwards.

Re: foreach loop problems

2002-02-13 Thread James Taylor
Ha, Ok well that was interesting. I ran this script on a different machine and it works fine... Weird. So, nevermind :) On Wednesday 13 February 2002 03:35 pm, you wrote: > I'm curious how you got this script to work, I re-wrote his with something > like this: > > my @hosts = ("1.com", "2.com

Re: foreach loop problems

2002-02-13 Thread James Taylor
I'm curious how you got this script to work, I re-wrote his with something like this: my @hosts = ("1.com", "2.com", "3.com", "4.com"); foreach my $key (@hosts) { system("ssh -l @ARGV[0] $key"); } and it will SSH to 1.com ONLY. After the session with 1.com is ended, it doesn't continue on

Re: foreach loop problems

2002-02-13 Thread Johnathan Kupferer
I was actually surprised to see that ssh worked like this! I don't think you can always get away with it, but I just tested it out and was able to call up ssh for 4 different machines using a script similar to that one. I don't think all programs are going to be that nice. Can anyone explain

Re: foreach loop problems

2002-02-13 Thread Michael Kelly
On 2/13/02 2:44 PM, dan radom <[EMAIL PROTECTED]> wrote: > Hi, > > > I've got a problem with the following code... > > my @hosts=qw( lunar solar venus mars saturn pluto ); > > foreach (\@hosts) { > system("/usr/bin/ssh @hosts $ARGV[0]"); > } > > > > What I'm wanting to do is call foo.p

Re: foreach loop problems

2002-02-13 Thread James Taylor
I don't believe this is what he's asking - What the problem is in this code is that after the first instance of SSH runs, and then exits, it will not continue on to the next key in the array. I can't figure out why it won't do it, I don't generally write programs using system calls :) On Wed

Re: foreach loop problems

2002-02-13 Thread Johnathan Kupferer
# Create array @hosts... So far so good. my @hosts=qw( lunar solar venus mars saturn pluto ); # \@hosts creates a reference to @hosts. You just want @hosts. # # The way you've written it, the elements in @hosts will be # assigned to the special variable $_. This is all right, but # tends to ge

Re: array references

2002-02-13 Thread Andrea Holstein
In article <[EMAIL PROTECTED]> wrote "Jon Serra" <[EMAIL PROTECTED]>: > Greetings, > > I have an array, each element will contain a reference to another array. How > can I dynamically generate each of those references such that each reference is >unique. I am > trying to create dynamic

RE: Joining or pushing an element to an array

2002-02-13 Thread J . Hourihane
Overall Goal: Well what I want to do is print out all the users in the passwd file and match them up to their respective groups I can open up the passwd file and the group file but I don't know how to merge them together. Ideally I would like to possibly put the group file in a hash but as you can

Re: array references

2002-02-13 Thread Johnathan Kupferer
Jon Serra wrote: >Greetings, > >I have an array, each element will contain a reference to another array. How >can I dynamically generate each of those references such that each reference is >unique. I am trying to create dynamic 2d arrays. TIA JON > # # The key is understanding 'my' an

foreach loop problems

2002-02-13 Thread dan radom
Hi, I've got a problem with the following code... my @hosts=qw( lunar solar venus mars saturn pluto ); foreach (\@hosts) { system("/usr/bin/ssh @hosts $ARGV[0]"); } What I'm wanting to do is call foo.pl uname (for example) and have the script ssh host uname for each host define

Re: octal file permissions

2002-02-13 Thread Tanton Gibbs
To change from decimal to octal, you can use sprintf with a %o format string my $val = sprintf( "%o", 8 ); print $val; 10 - Original Message - From: "zentara" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 13, 2002 5:20 PM Subject: octal file permissions > > I

TK list

2002-02-13 Thread Murzc
HI, I was suggested to get information for a technical TK question to: "re-ask your question on the ptk list or comp.lang.perl.tk where win32 people can help." Would anyone be able to direct me to find either ptk list, comp.lang.perl.tk, or both. Or is there a TK list? Thanks. -- To unsubsc

Sites

2002-02-13 Thread Naveen Parmar
Any recommendations on free Web sites where you may upload Perl scripts and execute CGI scripts? TIA, - NP _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECT

octal file permissions

2002-02-13 Thread zentara
I'm trying to save file permissions with stat, so I can restore permissions back to the file after editing. my $mode = (stat $open)[2]; #and then later chmod $mode,$open; The program is working, but it has caused me to wonder what is going on with the octal permissions. For instance, if I ha

array references

2002-02-13 Thread Jon Serra
Greetings, I have an array, each element will contain a reference to another array. How can I dynamically generate each of those references such that each reference is unique. I am trying to create dynamic 2d arrays. TIA JON -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

RE: ADO syntax

2002-02-13 Thread RArul
You should not expect VisualBasic behavior in Perl. You have to be punctilious for each paranthesis and braces. Try to create a separate scalar var for say $objParam like this (that saves some typing): $objParam = $objCmd->Parameters; $objParam->Append($

ADO syntax

2002-02-13 Thread mb
Hi all, can some one tells me what is wrong with that : $Conn->Execute("create procedure textproc \@val varchar(25) as select AR_Ref ,AR_Design from F_Article where AR_design like \@val"); $cmd->{ActiveConnection} = $Conn; $cmd->{CommandText} = "{call textproc (?)}"; $cmd->Paramete

Perplexing server error (premature end of script headers)

2002-02-13 Thread Peter Cline
I am getting a premature end of script headers error when running a particular script from a browser. It runs fine the command line, printing the proper header and all. I use the CGI.pm module to print the header, and do not print anything prior to the header. I do not understand why this er

Re: Can't take stdout in w98 xcopy

2002-02-13 Thread John W. Krahn
Daniel Sanchez Fabregas wrote: > > Triyng > > $x=qx(xcopy a:\\1*.* c:\\tmp); > print"\n after \n$x \n before \n"; You could always use the File::Copy module. perldoc File::Copy John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-ma

Re: hard question (for me)

2002-02-13 Thread John W. Krahn
Vitor Carlos Flausino wrote: > > Can someone tell me what does this pattern means? > > ((NI)( NI| )? ?(\d{10}|\w{5})|(NI )?(QG|SR) ?(\d{9})) Match 'NI' followed by ' NI' or ' ' or '' followed by ' ' or '' followed by ten digits [0-9] or five word charcters [a-zA-Z0-9_] OR match 'NI ' or '' foll

array question and ODBC note

2002-02-13 Thread John
Recently someone pointed out that it's better to use: while( defined( my $line = )) than while( my $line = ) so I have been moving towards this. I noticed that with arrays, such as: while( defined( my @data = $sth->fetchrow_array())) this does not work - @data is defined (as a zero item

Re: Perl regular expresions HELP!

2002-02-13 Thread John W. Krahn
Bruce Ambraal wrote: > > Please explain to me what this code does, here I'm tying to rename files > in current directory to 1.fil, 2.fil, ... > > [snip code] > > The complete program is: > > #!/usr/local/bin/perl -w > # first example... > > use

RE: finding max value

2002-02-13 Thread Jeremy Vinding
> > of course, the results still favor sort: > > > > Benchmark: timing 100 iterations of for 10_000 elems, for > 20 elems, sort > > 10_000 elems, sort 20 elems... > > for 10_000 elems: 7 wallclock secs ( 5.11 usr + 0.02 sys = > 5.13 CPU) @ > > 194931.77/s (n=100) > > for 20 elems: 8 wal

Re: Number Truncation/Rounding

2002-02-13 Thread Brett W. McCoy
On Wed, 13 Feb 2002, Balint, Jess wrote: > Hello all. I have a script that uses alot of data and calculates a > cumulative percent of this data. That cumulative percent should be 100.00 at > the end. What I get is: > > 99.8 > > I need to truncate this to 2 decimal places and hopefully

RE: finding max value

2002-02-13 Thread Chas Owens
On Wed, 2002-02-13 at 13:50, Jeremy Vinding wrote: > > >there must be a flaw in my test here: > > > > > >my @bob = rand for (1..20); > > >my @joe = rand for (1..10_000); > > > > Those. > > > > my @bob = map rand, 1 .. 20; > > my @joe = map rand, 1 .. 10_000; > > > > duh... thx > of course, th

Re: finding max value

2002-02-13 Thread Tagore Smith
Jeremy Vinding wrote: > duh... thx > of course, the results still favor sort: > > Benchmark: timing 100 iterations of for 10_000 elems, for 20 elems, sort > 10_000 elems, sort 20 elems... > for 10_000 elems: 7 wallclock secs ( 5.11 usr + 0.02 sys = 5.13 CPU) @ > 194931.77/s (n=100) > f

Re: regex question

2002-02-13 Thread Johnathan Kupferer
> > >client=& # 8 digits and then ampersand > >so what I want to strip out is stuff like: > >client=23894749& > You want something like: $url =~ s/client=\d\d\d\d\d\d\d\d&//; or if you don't want to count those \d's $url =~ s/client=\d{8}&//; And since cilent=& probably can pr

Re: Will not Work on the Server.

2002-02-13 Thread Anthony LaBerge
I Fixed it, It was a problem with the Permissions that are set automaticly to NOT let anyone execute the file. thanks for the help -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: regex question

2002-02-13 Thread James Kelty
This might work for you. I don't really have all the info from you that I would need, but assuming that there is a file "url.txt" that is formated like this: http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&; http://www.feathertrip.net/cgi-bin/index.cgi?client=23894749&; http://www.fe

RE: finding max value

2002-02-13 Thread Jeremy Vinding
> >there must be a flaw in my test here: > > > >my @bob = rand for (1..20); > >my @joe = rand for (1..10_000); > > Those. > > my @bob = map rand, 1 .. 20; > my @joe = map rand, 1 .. 10_000; > duh... thx of course, the results still favor sort: Benchmark: timing 100 iterations of for 10_0

Re: Will not Work on the Server.

2002-02-13 Thread Anthony LaBerge
Where do I need to include that line? will this work? printer.pl 1~ #!/usr/bin/perl 2~ 3~ print "Content-type: text/html\n\n"; 4~ $postfile = 'posts.fil'; 5~ open(INFO, "<$postfile" ); 6~ @PostLines = ; 7~ close(INFO) ; 8~ print "Post Tester\n"; 9~ print "\n"; 10~ foreach $line (@PostLines) 11

Re: Number Truncation/Rounding

2002-02-13 Thread Michael Fowler
On Wed, Feb 13, 2002 at 01:21:07PM -0500, Balint, Jess wrote: > Hello all. I have a script that uses alot of data and calculates a > cumulative percent of this data. That cumulative percent should be 100.00 at > the end. What I get is: > > 99.8 > > I need to truncate this to 2 decima

RE: Will not Work on the Server.

2002-02-13 Thread Balint, Jess
If you 'use CGI', you can get all the tags and header automatically from your object. Checkout perldoc CGI. -J-e-s-s- -Original Message- From: Anthony LaBerge [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 9:54 AM To: [EMAIL PROTECTED] Subject: Will not Work on the Server.

Re: Number Truncation/Rounding

2002-02-13 Thread Jonathan E. Paton
--- "Balint, Jess" <[EMAIL PROTECTED]> wrote: > Hello all. I have a script that uses alot of data and > calculates a cumulative percent of this data. That > cumulative percent should be 100.00 at the end. What I > get is: > > 99.8 > > I need to truncate this to 2 decimal places and

RE: finding max value

2002-02-13 Thread Jeff 'japhy' Pinyan
On Feb 13, Jeremy Vinding said: >there must be a flaw in my test here: > >my @bob = rand for (1..20); >my @joe = rand for (1..10_000); Those. my @bob = map rand, 1 .. 20; my @joe = map rand, 1 .. 10_000; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI A

regex question

2002-02-13 Thread rory oconnor
I am using LWP to hit a page and save the source to a file. But before it saves it I want it to strip out the client id from the urls. They are always in the same format: client=& # 8 digits and then ampersand so what I want to strip out is stuff like: client=23894749& i am a newbie

Number Truncation/Rounding

2002-02-13 Thread Balint, Jess
Hello all. I have a script that uses alot of data and calculates a cumulative percent of this data. That cumulative percent should be 100.00 at the end. What I get is: 99.8 I need to truncate this to 2 decimal places and hopefully round it to 100.00. Thanks in advance. --Jess -- T

Re: Scan data for XML invalid characters and parse articles

2002-02-13 Thread John
Here is what I ended up with - this is a chunk from a much bigger script. Suggestions gladly accepted. Haven't fixed the special characters yet. my ( $date, $p, @articles ) = (); if ( ! defined( $p = HTML::TokeParser->new( $html ))) { localError( "Unable to parse $html : $!" ); } my ( $

Re: Resourch kit commands...

2002-02-13 Thread Michael Stidham
To accept stnin use something like this: chomp ($var = ); If you want to use a resource kit command then remember that perl needs to know how to interpret the command and not think its part of its own function, so enclose the resource kit command in tics like so: `reg query "HKLM\software\somew

Re: Scan data for XML invalid characters and parse articles

2002-02-13 Thread John
At Wednesday, 13 February 2002, "Brett W. McCoy" wrote: > >Don't use regex to pull apart HTML, it'll be trouble that it's worth. Are you sure about this or am I still going about this wrong. I haven't tried this yet, haven't even gotten to the articles. This had been a really simple regex to

Re: How do I test for a NULL string value

2002-02-13 Thread Randal L. Schwartz
> "Paul" == Paul Johnson <[EMAIL PROTECTED]> writes: Paul> Start with perldata, which says "there are actually two varieties of Paul> null strings", and has done since at least Perl 4. The Perl 1 manpage Paul> mentions null strings. So do Learning Perl (2nd ed) and Learning Perl Paul> on Wi

Re: How do I test for a NULL string value

2002-02-13 Thread Paul Johnson
On Tue, Feb 12, 2002 at 07:54:23AM -0800, Randal L. Schwartz wrote: > Perl doesn't have NULL strings, so you can't test for them. Perl > has undef values, empty strings, strings that have only newline, > strings with only white space, strings that are false, and those > are all t

Re: "Learning Perl" Question

2002-02-13 Thread Michael Fowler
On Wed, Feb 13, 2002 at 11:05:51AM -0500, Hanson, Robert wrote: [snip] > In chapter 2 it mentions a rule in Perl: "any time that you need a variable > in Perl, you can use an assignment instead. First, Perl does the > assignment. Then it uses the variable in whatever way you requested". > > Ok

RE: "Learning Perl" Question

2002-02-13 Thread Bob Showalter
> -Original Message- > From: Hanson, Robert [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 11:06 AM > To: [EMAIL PROTECTED] > Subject: "Learning Perl" Question > > > [Sorry if this isn't the place to post this, but I thought it might be > interesting. Flaming will be ac

RE: finding max value

2002-02-13 Thread Jeremy Vinding
there must be a flaw in my test here: Benchmark: timing 100 iterations of for 10_000 elems, for 20 elems, sort 10_000 elems, sort 20 elems... for 10_000 elems: 6 wallclock secs ( 4.75 usr + 0.00 sys = 4.75 CPU) @ 210526.32/s (n=100) for 20 elems: 6 wallclock secs ( 4.86 usr + 0.00

Re: Scan data for XML invalid characters and parse articles

2002-02-13 Thread Morbus Iff
>I have a scalar variable containing HTML that needs to be converted >to XML. It's not the best HTML so it has invalid characters (like >smart quotes, 1/2 character, etc.). I need to determine if these >characters exist in the data and throw an error if they do. What >is the best way to do

Re: Scan data for XML invalid characters and parse articles

2002-02-13 Thread Brett W. McCoy
On Wed, 13 Feb 2002, John wrote: > I have a scalar variable containing HTML that needs to be converted > to XML. It's not the best HTML so it has invalid characters (like > smart quotes, 1/2 character, etc.). I need to determine if these > characters exist in the data and throw an error if they

RE: Will not Work on the Server.

2002-02-13 Thread Scott Lutz
(I am going to guess that you are trying to access this through a web browser? If not then forgive me!) You need to include : print "Content-type: text/html\n\n"; before you attempt to print it out. Scott Lutz Pacific Online Support Phone: 604.638.6010 Fax: 604.638.6020 Toll Free: 1.877.503.9870

Re: Scan data for XML invalid characters and parse articles

2002-02-13 Thread Adam Turoff
On Wed, Feb 13, 2002 at 08:40:14AM -0800, John wrote: > I have a scalar variable containing HTML that needs to be converted > to XML. It's not the best HTML so it has invalid characters (like > smart quotes, 1/2 character, etc.). I need to determine if these > characters exist in the data and

Scan data for XML invalid characters and parse articles

2002-02-13 Thread John
I have a scalar variable containing HTML that needs to be converted to XML. It's not the best HTML so it has invalid characters (like smart quotes, 1/2 character, etc.). I need to determine if these characters exist in the data and throw an error if they do. What is the best way to do this?

Resourch kit commands...

2002-02-13 Thread Bishop, Peter
Hello all, I am trying to create a script that will accept a server name via and and run commands from the Win2k resource kit. My question is how do I code these commands? Is there a function for srvinfo, for example? Thanks in advance! Peter Bishop -- Sent from my Black

RE: finding .jpg or any .extention file

2002-02-13 Thread John Edwards
Why bother with reading the file in again and again?? Just do this 1)Open a file, create if necessary, read contents into @original array 2)Prints you name into the file every time someone presses "enter", AND appends to @original 3)Print a newline 4)Seek to the beginning of the file without clo

RE: finding .jpg or any .extention file

2002-02-13 Thread Bruce Ambraal
John This is greater than great... Thinks are getting to hot for me. Thank again, I'll chat to you tomorrow, have to go... In mean time you may think about the this one, and don't tell me you got this one too. Goes like this: 1)Open a file, create if necessary, 2)Prints you name into the file e

Re: finding max value

2002-02-13 Thread Chas Owens
On Wed, 2002-02-13 at 10:34, [EMAIL PROTECTED] wrote: > > "Frank" == Frank <[EMAIL PROTECTED]> writes: > > > Frank> Yeah, my bad.. I shoulda tested it: > Frank> $max=(sort{$a<=>$b}@a)[-1]; > > Or sort descending, probably a bit faster than a literal slice: > > my ($max) = sort { $b <=> $a

Re: finding max value

2002-02-13 Thread Chas Owens
On Wed, 2002-02-13 at 10:34, [EMAIL PROTECTED] wrote: > > "Frank" == Frank <[EMAIL PROTECTED]> writes: > > > Frank> Yeah, my bad.. I shoulda tested it: > Frank> $max=(sort{$a<=>$b}@a)[-1]; > > Or sort descending, probably a bit faster than a literal slice: > > my ($max) = sort { $b <=> $a

RE: finding .jpg or any .extention file

2002-02-13 Thread John Edwards
Try this... #!/usr/local/bin/perl -w # first example... use strict; # declarations... my @files = `ls -F`; my @jpegs; print "Enter a file extension (e.g jpg): "; chomp(my $extension = ); print "\n"; until ($extension =~ /^[A-Za-z]{3}$/) { print "Please enter a three letter extension.

"Learning Perl" Question

2002-02-13 Thread Hanson, Robert
[Sorry if this isn't the place to post this, but I thought it might be interesting. Flaming will be accepted] I'm teaching a Perl class from the Learning Perl book, and noticed an inconsistency with the way certain constructs work. In chapter 2 it mentions a rule in Perl: "any time that you nee

Will not Work on the Server.

2002-02-13 Thread Anthony LaBerge
I'm having a little trouble getting this simple test file to run on a server. printer.pl 1~ #!/usr/bin/perl 2~ 3~ $postfile = 'posts.fil'; 4~ open(INFO, "<$postfile" ); 5~ @PostLines = ; 6~ close(INFO) ; 7~ print "Post Tester\n"; 8~ print "\n"; 9~ foreach $line (@PostLines) 10~ { 11~ print "

RE: finding .jpg or any .extention file

2002-02-13 Thread Bruce Ambraal
Hey!!! This man is really hot, he must be the man of the hour with more power. thanks and just for this last one modfication to the obove: "Now I need to read in the extension from the command line" John how long are you into perl? Cheers Bruce >>> John Edwards <[EMAIL PROTECTED]> 02/

RE: Printing values from hashes

2002-02-13 Thread J . Hourihane
Thanks very much Steve I was pulling my hair out on this one.. I interpreted the split/:+/ to be one or more ':' the key work being "or" I guess I really need to go back and review regexes Jaime Hourihane CDC-IXIS 212.891.1935 -Original Message- From: Steve Mayer [mailto:[EMAIL PROTECT

RE: Can't take stdout in w98 xcopy

2002-02-13 Thread Timothy Johnson
I think that XCOPY uses STDERR for some of its on-screen printing. You could try to redirect that to a file and then read that in later: open(STDERR,">errlog.txt"); should work. -Original Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2/13/02 6:40 AM Subject: Can't take

TK::Text issue that I can;t figure out how to properly get formatted printout of...

2002-02-13 Thread Chris
The following code works great to put the text onto the screen: #*** #* #* Add the Summary Textbox #* #*** my $t = $f->Text( -width => 65, -height => 4, -wrap => 'word

Re: Printing values from hashes

2002-02-13 Thread Steve Mayer
Jaime, The problem is with the regular expression that you are using in the split function. When you say to use 1 or more ":" for the separator, you are causing the password field to be skipped (if it is empty as you will have two "::" together. If you change your regexp to just be

RE: Printing values from hashes

2002-02-13 Thread John Edwards
Are you sure that $VALUE is recieving a value from the split?? If so your code should print out the $VALUE value (you may want to pick some better var names...) John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 13 February 2002 15:42 To: [EMAIL PROTECTED] S

Re: Printing values from hashes

2002-02-13 Thread J . Hourihane
Hi I am new to hashes Can somebody tell me why I can print $KEY but not $VALUE? == #!/usr/local/bin open(GROUP, "/etc/group") || die "Cannot open:$!\n"; while() { ($KEY,$gpass,$ggid,$VALUE) = split(/:+/); $HASH{$KEY} = "$VA

Re: finding max value

2002-02-13 Thread Randal L. Schwartz
> "Frank" == Frank <[EMAIL PROTECTED]> writes: Frank> Yeah, my bad.. I shoulda tested it: Frank> $max=(sort{$a<=>$b}@a)[-1]; Or sort descending, probably a bit faster than a literal slice: my ($max) = sort { $b <=> $a } @input; -- Randal L. Schwartz - Stonehenge Consulting Services, Inc

Re: finding max value

2002-02-13 Thread Randal L. Schwartz
> "Jeff" == Jeff 'Japhy' Pinyan <[EMAIL PROTECTED]> writes: Jeff> On Feb 13, Frank said: >> $max= (sort @values)[-1]; Jeff> You're sorting ASCIIbetically. You must sort numerically: Jeff> (sort { $a <=> $b } @values)[-1]; >> Personally, I'd prefer Japhy's method for efficiency. Jeff> Y

More clarity needed for fetchrow_arrayref()

2002-02-13 Thread McElwee, Shane
> Hi, > > I'm trying to capture output from a table description query, input it into > an array and use each line of that array as part of a CREATE statement. > I'm > trying to use fetchrow_arrayref() but I'm not sure I'm using it correctly > or > if its what I should be using. This code won't wo

RE: windows perl just doesn't seem to work

2002-02-13 Thread Jason Larson
># this is a script to clean > >open(IN,"fileToClean.asc") || die "can't open!"; > >while() { >s/Good/Bad/; >print; >} > >On the screen I can see that this is working, but when I open the file, >guess what? Nothing has changed! ...can anybody figure out what I am doing >wrong? I'm st

RE: Perl regular expresions HELP!

2002-02-13 Thread John Edwards
foreach my $f ( @files ){ # Iterate through the @files array, foreach iteration set the value of $f to the next element of @files if( $f =~ /private/ ){ next; } # If the scalar $f contains the text "private", then stop this iteration and move onto the next one chomp $f; #

RE: Can't take stdout in w98 xcopy

2002-02-13 Thread Jason Larson
Triyng $x=qx(xcopy a:\\1*.* c:\\tmp); print"\n after \n$x \n before \n"; this is how it looks my dos session C:\WINDOWS\Escritorio>perl -w kk.pl 13feb.zip 1 archivos copiados after before -

Re: finding max value

2002-02-13 Thread Jeff 'japhy' Pinyan
On Feb 13, Frank said: >$max= (sort @values)[-1]; You're sorting ASCIIbetically. You must sort numerically: (sort { $a <=> $b } @values)[-1]; >Personally, I'd prefer Japhy's method for efficiency. Yeah, me too. ;) Sorting to find a min or max is not a good move. -- Jeff "japhy" Pinyan

Re: can't print input argument

2002-02-13 Thread William.Ampeh
You want to print the array ARGV and not the variable ARGV For all command line arguments print @ARVG For the first command line argument, print $ARGV[0] __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e

Re: hard question (for me)

2002-02-13 Thread Kliment Ognianov
Vitor Carlos Flausino wrote: > Can someone tell me what does this pattern means? > > ((NI)( NI| )? ?(\d{10}|\w{5})|(NI )?(QG|SR) ?(\d{9})) > > > Who is $1, $2, $3 . > > thanks, > > -vcf.DTI.PGA > > /(.#1..)(..#2.) . (...#N..) / (...1...) => $1 ;(...2...) => $2(...N...) => $N -- T

Can't take stdout in w98 xcopy

2002-02-13 Thread daniel . sanchez . fabregas
Triyng $x=qx(xcopy a:\\1*.* c:\\tmp); print"\n after \n$x \n before \n"; this is how it looks my dos session C:\WINDOWS\Escritorio>perl -w kk.pl 13feb.zip 1 archivos copiados after before -

hard question (for me)

2002-02-13 Thread Vitor Carlos Flausino
Can someone tell me what does this pattern means? ((NI)( NI| )? ?(\d{10}|\w{5})|(NI )?(QG|SR) ?(\d{9})) Who is $1, $2, $3 . thanks, -vcf.DTI.PGA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Perl regular expresions HELP!

2002-02-13 Thread Bruce Ambraal
Please explain to me what this code does, here I'm tying to rename files in current directory to 1.fil, 2.fil, ... foreach my $f ( @files ){ if( $f =~ /private/ ){ next; } chomp $f; $fil{$f} = 0; # if we match the extension... if( $f =~ /\.$extension$/ ){

Re: windows perl just doesn't seem to work

2002-02-13 Thread Dennis G. Wicks
Greetings; Just for future reference, the Windows command line is not good for perl things. The use of quotes and escapes is mostly undocumented and from experience I can say that even when you think you have it figured out you will find another situation where it doesn't work. It only takes a fe

RE: can't print input argument

2002-02-13 Thread Bob Showalter
> -Original Message- > From: Booher Timothy B 1stLt AFRL/MNAC > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 7:37 PM > To: [EMAIL PROTECTED] > Subject: can't print input argument > > > Hello - more trouble, I just can't seem to write a program > that prints an > argumen

forking in NT

2002-02-13 Thread srinivas krish
Hi!, I have to make a platform independent script that will start a server and client in the script. I attempted this using fork method. Although the script runs well in UNIX, it does not run on Nt - giving the error: The process cannot access the file because it is being used by another process.

Re: finding max value

2002-02-13 Thread Frank
On Wed, Feb 13, 2002 at 02:08:23PM +0100, Jon wrote: > Frank wrote: > > > > On Wed, Feb 13, 2002 at 01:17:50PM +0100, Andrea wrote: > > > In article <[EMAIL PROTECTED]> wrote >"Jeff 'Japhy' Pinyan" > > > <[EMAIL PROTECTED]>: > > > > > > >>I have a set of functions that give numeric results, and

Getting CD volume info

2002-02-13 Thread Dermot Paikkos
Hi Guru's, sys stuff: perl win32, Active perl build 626. I have a script that I use to extract files from a CD (drive f: on my PC). Each CD is labelled when it is burnt and I am after a way to get the volume label. I thought stat or lstat might do it but it is not giving me the CD volume nam

Re: finding max value

2002-02-13 Thread Chas Owens
On Wed, 2002-02-13 at 08:08, Jon Molin wrote: > Frank wrote: > > > > On Wed, Feb 13, 2002 at 01:17:50PM +0100, Andrea wrote: > > > In article <[EMAIL PROTECTED]> wrote >"Jeff 'Japhy' Pinyan" > > > <[EMAIL PROTECTED]>: > > > > > > >>I have a set of functions that give numeric results, and I need

Re: [Fwd: Returned mail]

2002-02-13 Thread Frank
On Wed, Feb 13, 2002 at 08:59:57AM -0500, Susan wrote: > > What is the fastest or best way to sort a file alphabetically, the > rewrite it to a file. > ---end quoted text--- A few questions: 1) How big is the file? 2) Fastest Sorting method or quickest piece of code to write? 3) Is this homewor

  1   2   >