Re: how the print the first 7 letter of file name

2004-10-25 Thread Bernard Kenik
I was not trying to come up with an altenative regex to do what he might have wanted (first 7 characters or filename up to the underscore) I was trying to understand what "[^/]*" did in your regex. I know that you said that it was to make sure that there was not any "/" after the 7 characters.

Re: problem printf

2004-10-25 Thread deny
That isn't only perl code, it's incomplete, and it doesn't use 'printf'. Show us more code and explain your problem fully. thanks for your help here is the complete code #!/usr/bin/perl use MD5; require 'find.pl'; $md5 = new MD5; @dirs = @ARGV; foreach $dir ( @dirs ) { find($dir); } sub

how to give stdin at the end of a url

2004-10-25 Thread E.Horn
Hey! I want to get information out of this page. My problem is,how can i give ($eingabe)into the url? Because that varies the output of the xmlsource! exampe: $url=.term=gtpase... gives me the result of all gtpases...how can i use a funktion or variable to make it possible ti give it into t

LWP::Simple use proxy

2004-10-25 Thread Ramprasad A Padmanabhan
Hi All, I am using LWP::Simple; I want use of proxy to be enabled from the environment. In LWP::UserAgent there is a method env_proxy by which I can do this. How can I do a similar thing for LWP::Simple; Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

assign operator as variable

2004-10-25 Thread Khairul Azmi
I am not sure what category should this question fall under but this is what I plan to do. $cond1 = 1; $cont2 = 0; $oper1="&&"; # for AND $oper2="||"; # for OR if ($cond1 $oper1 $cond2) { print "one \n"; } else { print "two \n"; } The statement above would generates errors. Can somebody tel

Re: assign operator as variable

2004-10-25 Thread Gabor Urban
On Mon, 2004-10-25 at 11:39, Khairul Azmi wrote: > I am not sure what category should this question fall under but this > is what I plan to do. > > $cond1 = 1; > $cont2 = 0; > $oper1="&&"; # for AND > $oper2="||"; # for OR > > if ($cond1 $oper1 $cond2) { > print "one \n"; > } else { > print

Re: assign operator as variable

2004-10-25 Thread Khairul Azmi
Actually I am looking for an alternative to replace the conventional symbol "&&" with other variable eg $AND_operator so that the following statement is valid if ($cond1 $AND_operator $cond2) Thanks On Mon, 25 Oct 2004 10:44:19 +0100, Marcos Rebelo <[EMAIL PROTECTED]> wrote: > Maybe this can h

RE: assign operator as variable

2004-10-25 Thread Marcos Rebelo
if (eval("$cond1 $AND_operator $cond2")) is this correct? -Original Message- From: Khairul Azmi [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 25 de Outubro de 2004 11:00 To: [EMAIL PROTECTED] Subject: Re: assign operator as variable Actually I am looking for an alternative to replace t

Re: assign operator as variable

2004-10-25 Thread Khairul Azmi
Yes. Silly me. I put the eval operator right before variable $AND_operator. Thanks a lot guys. On Mon, 25 Oct 2004 11:03:24 +0100, Marcos Rebelo <[EMAIL PROTECTED]> wrote: > if (eval("$cond1 $AND_operator $cond2")) > > is this correct? > > -Original Message- > From: Khairul Azmi [mailto

Interactive socket client

2004-10-25 Thread mkondelk
I have this interactice client: #!/usr/bin/perl -w use strict; use IO::Socket; my ($host, $port, $kidpid, $handle, $line); unless (@ARGV == 2) { die "usage: $0 host port" } ($host, $port) = @ARGV; # create a tcp connection to the specified host and port $handle = IO::Socket::INET->new(Proto => "tcp

memory usage of an array

2004-10-25 Thread Bryan Harris
The "books" say that you can add items to an array until you run out of memory... Is there any way for a script to see how much memory is in use so far, versus how much there is left? - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Limits on globbing?

2004-10-25 Thread Bryan Harris
> If thats so, here's something to keep you entertained. Yet another script that doesn't work as received... To make it work I had to remove line 1, and then it still threw a bunch of errors at runtime. Still, it's pretty cool. =) - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addi

thx

2004-10-25 Thread Stefan Hans
Thx for the answer. I just was following the install-instructions " It's all pure Perl, so just put the .pm files in their appropriate local Perl subdirectories" and I had only under /usr/lib/perl5/5.8.0/ *.pm-files. That is why I copied RecDescent.pm there. Later I did the perl-Makefile.PL-make-

Re: thx

2004-10-25 Thread Gunnar Hjalmarsson
Stefan Hans wrote: Gunnar Hjalmarsson wrote: Why didn't you install also Parse::RecDescent using Makefile.PL etc.? I just was following the install-instructions " It's all pure Perl, so just put the .pm files in their appropriate local Perl subdirectories" Hmm.. That works, of course, if you know

Re: problem printf

2004-10-25 Thread Owen
On Mon, 25 Oct 2004 05:17 pm, deny wrote: > foreach $name ( sort @files) { >     ($uid,$gid) = (stat $nane)[4,5]; stat $nane or $name? Owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: problem printf

2004-10-25 Thread Flemming Greve Skovengaard
deny wrote: That isn't only perl code, it's incomplete, and it doesn't use 'printf'. Show us more code and explain your problem fully. thanks for your help here is the complete code #!/usr/bin/perl use MD5; require 'find.pl'; $md5 = new MD5; @dirs = @ARGV; foreach $dir ( @dirs ) { find($

Re: how to give stdin at the end of a url

2004-10-25 Thread Chris Devers
On Mon, 25 Oct 2004, E.Horn wrote: > I want to get information out of this page. > My problem is, how can i give ($eingabe) into the url? > Because that varies the output of the xmlsource! > > example: > > $url=.term=gtpase... > > gives me the result of all gtpases... > > How can I use

Re: how to give stdin at the end of a url

2004-10-25 Thread E.Horn
thanks a lot! I will look at this! I have done it my way and i think now it works... I think it is not the best way,but i am happy with it! I learn perl for a week now...i am proud that is gives any result! #!/xprog/bin/perl -w use LWP::Simple; sub daten_einlesen { printf "geben Sie ein gtpprotei

Re: problem printf

2004-10-25 Thread Jenda Krynicky
From: deny <[EMAIL PROTECTED]> > here is the complete code > > #!/usr/bin/perl > > use MD5; > require 'find.pl'; > > $md5 = new MD5; > @dirs = @ARGV; > > foreach $dir ( @dirs ) { find($dir); } > sub wanted { push @files, $name; } > > foreach $name ( sort @files) { > ($uid,$gid) = (stat

Re: How to remove trailing zero

2004-10-25 Thread John W. Krahn
Khairul Azmi wrote: Can somebody help me how to remove the trailing zero from an ip address $ip_add = "010.200.020.000"; The output should be "10.200.20.0"; I''ve been trying many regex techniques but still unsuccessful. $ perl -le'$_ = "010.200.020.000"; print; s/\b0+(?=\d)//g; print' 010.200.020

Populating HASH from file

2004-10-25 Thread Jeff Borders
Newbie here, I need to dump a plain text file that has the format of: key = value (ie. question answer) into a hash. I'm writing a simple learning tool to help me learn some basic korean terminology. Would someone be kind enough to point me in the right direction. -Jeff Borders korean.txt:

Re: Populating HASH from file

2004-10-25 Thread Jeff 'japhy' Pinyan
On Oct 25, Jeff Borders said: >I need to dump a plain text file that has the format of: > >key = value (ie. question answer) > >into a hash. I'm writing a simple learning tool to help me learn some >basic korean terminology. > >Would someone be kind enough to point me in the right direction. Yo

Re: Populating HASH from file

2004-10-25 Thread John W. Krahn
Jeff Borders wrote: I need to dump a plain text file that has the format of: key = value (ie. question answer) into a hash. I'm writing a simple learning tool to help me learn some basic korean terminology. Would someone be kind enough to point me in the right direction. -Jeff Borders korean.txt:

Re: Populating HASH from file

2004-10-25 Thread Edward WIJAYA
Hi, Mine is not as elegant as J.Krahn's or Jeff's. But it's an alternative. I am just glad to contribute at least something to the forum I have owed so much... -- Regards, Edward WIJAYA SINGAPORE --- use strict; use warnings; use Data::Dumper; my %hash = (); while () { s

Re: problem printf

2004-10-25 Thread John W. Krahn
deny wrote: That isn't only perl code, it's incomplete, and it doesn't use 'printf'. Show us more code and explain your problem fully. thanks for your help here is the complete code #!/usr/bin/perl use warnings; use strict; use MD5; use Digest::MD5; require 'find.pl'; use File::Find; $md5 =

Re: Populating HASH from file

2004-10-25 Thread John W. Krahn
Edward WIJAYA wrote: Mine is not as elegant as J.Krahn's or Jeff's. But it's an alternative. I am just glad to contribute at least something to the forum I have owed so much... --- use strict; use warnings; use Data::Dumper; my %hash = (); while () { s/\s//g; You may be

Re: Strange Error

2004-10-25 Thread Mike Blezien
Gunnar Hjalmarsson wrote: Mike Blezien wrote: What does this type of error indicate, I never encountered this type of error before. - Modification of a read-only value attempted at /home/www/cgi/somescript.cgi line 151. -

parse xml

2004-10-25 Thread E.Horn
Hey! How can i pars this xmlfile? i just want to have the geo and the count out of this... geo GEO Profiles 69408 Ok gds GEO DataSets 8

Re: parse xml

2004-10-25 Thread Traeder, Philipp
On Monday 25 October 2004 16:27, E.Horn wrote: > Hey! > How can i pars this xmlfile? > i just want to have the geo and the count out of > this... > [..] Hi, I can highly recommend XML::Simple - just use it like this: #!/usr/bin/perl -w use strict; use XML::Simple; use Data::Dumper; my $ref =

Re: problem printf

2004-10-25 Thread deny
Owen a écrit : On Mon, 25 Oct 2004 05:17 pm, deny wrote: foreach $name ( sort @files) { ($uid,$gid) = (stat $nane)[4,5]; stat $nane or $name? $name , error for me ,the result is the same if someone want the script for test -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional co

Re: Strange Error

2004-10-25 Thread Gunnar Hjalmarsson
Mike Blezien wrote: Gunnar Hjalmarsson wrote: Mike Blezien wrote: foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151 - Maybe it's that; hard to tell since you don't give more context. But what you are trying to do, i.e. using symbolic refe

perl.beginners Weekly list FAQ posting

2004-10-25 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):

Re: parse xml

2004-10-25 Thread Jenda Krynicky
From: "Traeder, Philipp" <[EMAIL PROTECTED]> > print $ref->{'ResultItem'}->[0]{'MenuName'}; I think it's better to either skip all the -> between subscriptions or include them all: print $ref->{'ResultItem'}[0]{'MenuName'}; or print $ref->{'ResultItem'}->[0]->{'MenuName'}; It do

syntax differences and performance

2004-10-25 Thread Adamiec, Larry
Given the following lines: $MESSAGE .= "Application Fee: " . $price . " Dollars U.S."; $MESSAGE .= "Application Fee: $price Dollars U.S."; Is there a performance issue (or any other issue) for using either of the above lines? Does it make any difference which is used? Suppose it changed to th

Re: syntax differences and performance

2004-10-25 Thread Steve Bertrand
> Given the following lines: > > $MESSAGE .= "Application Fee: " . $price . " Dollars U.S."; > > $MESSAGE .= "Application Fee: $price Dollars U.S."; > > > Is there a performance issue (or any other issue) for using either of > the above lines? Does it make any difference which is used? > > Suppose

Re: syntax differences and performance

2004-10-25 Thread Brian Gerard
And the clouds parted, and Adamiec, Larry said... > Given the following lines: > > $MESSAGE .= "Application Fee: " . $price . " Dollars U.S."; > > $MESSAGE .= "Application Fee: $price Dollars U.S."; > > > Is there a performance issue (or any other issue) for using either of > the above lines?

Re: syntax differences and performance

2004-10-25 Thread JupiterHost.Net
Steve Bertrand wrote: Given the following lines: $MESSAGE .= "Application Fee: " . $price . " Dollars U.S."; $MESSAGE .= "Application Fee: $price Dollars U.S."; In that case it seems a bit pointless to do the first way as there are now 3 things instead of 1 to deal with. the Benchmark module will

Re: parse xml

2004-10-25 Thread Philipp Traeder
On Monday 25 October 2004 16:49, Jenda Krynicky wrote: > From: "Traeder, Philipp" <[EMAIL PROTECTED]> > > > print $ref->{'ResultItem'}->[0]{'MenuName'}; > > I think it's better to either skip all the -> between subscriptions > or include them all: > > print $ref->{'ResultItem'}[0]{'MenuName'}

array of references

2004-10-25 Thread Scott Pham
I've been thinking about this and not sure how to approach this problem. Say I want to create an array of 4 array references, thats easy since I know that there will be 4 array references, how would I do this dynamically? Say if one I only needed 2 references and another I need 10 array references,

RE: array of references

2004-10-25 Thread Ed Christian
Scott Pham wrote: > I've been thinking about this and not sure how to approach this > problem. Say I want to create an array of 4 array references, thats > easy since I know that there will be 4 array references, how would I > do this dynamically? Say if one I only needed 2 references and > another

Re: uninstall perlmodule

2004-10-25 Thread Adam Saeed
one can uninstall the perl module.. by cd make distclean or just remove the path of perl module... or remove the path from env. table. On Sat, 23 Oct 2004 21:17:05 -0400 (EDT), Chris Devers <[EMAIL PROTECTED]> wrote: > On Sat, 23 Oct 2004, Bob Showalter wrote: > > > I forgot to add. If you'r

Re: foreach..

2004-10-25 Thread Dave Gray
> this is actual part of my code.. all work but it seems that something is > wrong in foreach part.. in reality script calculate $dodatne_opcije only! > $vrsta_paketa is not added in calculation.. > > my $vrsta_paketa = { > '20MB' => 205, > '50MB' => 270, > '100MB' => 350,

Re: Generate a perl list file

2004-10-25 Thread rs
> > Dear all. > > I have a tab delimited file as follow: > > V namep > 1.0 AAA 0.001 > 0.9 BBB 0.003 > 0.8 CCC 0.004 > . > > I need to convert the file into following format: > { labels = > ( > {v="1.0"; name = "AAA"; p = "0.001"; }, >

questions

2004-10-25 Thread M. Ilyas Hassan
hi, Could someone please help me with the following perl questions. #1 - Is there a way to add "days" to a date? I want end_date=start_date+90days; where start_date is in the format 10/25/04; the output end_date should be in the same format as well. I was not successful loading the Date::Calc mo

Re: array of references

2004-10-25 Thread Zeus Odin
push @array, [] while @array < 10; also works. "Ed Christian" <[EMAIL PROTECTED]> wrote... push (@array,[]) for (1..$num_child_arrays); For more info: perldoc -f push -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: questions

2004-10-25 Thread Gunnar Hjalmarsson
M. Ilyas Hassan wrote: #1 - Is there a way to add "days" to a date? I want end_date=start_date+90days; where start_date is in the format 10/25/04; the output end_date should be in the same format as well. I was not successful loading the Date::Calc module from CSPAN on ActivePerl 5 (Revision 5, ve

Re: questions

2004-10-25 Thread JupiterHost.Net
hi, Hello, Could someone please help me with the following perl questions. #1 - Is there a way to add "days" to a date? I want end_date=start_date+90days; where start_date is in the format 10/25/04; the output end_date should be in the same format as well. I was not successful loading the Date:

Re: questions

2004-10-25 Thread Chris Devers
On Mon, 25 Oct 2004, M. Ilyas Hassan wrote: > #1 - Is there a way to add "days" to a date? The modules that the other two respondants pointed you to are the right way to do this, but it's good to know that the way to do this by hand -- which you won't want to do, but it's good to see why not --

Extracting Directories and Sub Directories

2004-10-25 Thread Ron Smith
The following is the script: ---snip #!/usr/bin/perl -w use strict; use File::Basename; my @lines = dirname `dir /b/s`; print "@lines\n"; ---snip The following is the input: C:\Perl\scripts\shots\sp2\shot_1\dir.t

Re: Extracting Directories and Sub Directories

2004-10-25 Thread Gunnar Hjalmarsson
Ron Smith wrote: I would like the output to be the following: C:\Perl\scripts\shots\sp2\shot_1 <--current directory C:\Perl\scripts\shots\sp2\shot_1\sub_directory <--sub directory Ron, Recently you posted a related problem, but didn't even acknowledge that you got several respon

Re: Extracting Directories and Sub Directories

2004-10-25 Thread Ron Smith
The sulution that you and others gave to the previous problem worked out fine. I thought I sent mail regarding that. I didn't think that this was related to that problem; but, it is very similar. My appologies if I'm mistaken. TIA -- for any input you can give me. Ron --- Gunnar Hjalmarsson <[EM

Re: problem printf

2004-10-25 Thread deny
Try to add this lines somewhere the top of the file: use strict; use warnings; and report the errors, if any. Global symbol "$md5" requires explicit package name at ./checksum.pl line 11. Global symbol "@dirs" requires explicit package name at ./checksum.pl line 12. Global symbol "$dir" requires

MySQL+foreach loop.........roy

2004-10-25 Thread Roime bin Puniran
Hi all.. I have a script that read some text file in the directory...All the data inside the text file then would be extracted into my sql, and i used foreach loop to read the text file, the doing some loop while data are sorted..Here is my code. #!/usr/bin/per