Re: Download problem

2002-12-06 Thread zentara
On 06 Dec 2002 08:22:19 +0200, [EMAIL PROTECTED] (Stelian Iancu) wrote: Hello! I try to download a file from a CGI script. Here is the code: $self-header_props(-type='application/x-octet-stream', -attachment=$file); open(FILE, $file); binmode(FILE); $/ = undef;

While (FileHandler) only reads the first line

2002-12-06 Thread Hanming Tu
Hi, All, It is very strange. I have an Perl application developed on Unix box and want to port to Windows environment. All my file handlers only read the first line in the applications developed in Unix although they were working fine in Unix environment. Any clue? Thanks. sub readTaskHelp {

Upload (probably a stupid question)

2002-12-06 Thread Scot Robnett
How do I make my script only send the filename rather than the full path when I use the CGI.pm upload function? For example, when I upload the document test.xls On the remote server, it's being named with the full path of where I sent it from, like this C:\Documents and

Re: Upload (probably a stupid question)

2002-12-06 Thread Mystik Gotan
$var =~ tr/^\\\w+$//; # replace slashes and words with none, so this # kinda leaves you with nothing that the filename. # UNTESTED! I also recommend: $var =~ s/[^\w.-]/_/g; # which translate's some signs to underscores (_) -- Bob Erinkveld

Re: Download problem

2002-12-06 Thread zentara
On Fri, 06 Dec 2002 08:22:19 +0200, Stelian Iancu wrote: I try to download a file from a CGI script. Here is the code: $self-header_props(-type='application/x-octet-stream', -attachment=$file); open(FILE, $file); binmode(FILE); $/ = undef; my($data) =

Re: Snagging the last page of a report

2002-12-06 Thread zentara
On Thu, 5 Dec 2002 14:24:03 -0500, [EMAIL PROTECTED] (Paul Kraus) wrote: snip How to seek last 2k? Here's a start for you, getting the last 2k of the file. Looping and checking for last page break is left up to you. :-) #!/usr/bin/perl -w use strict; my $filename = shift or die Usage: $0 file

Re: what is this?

2002-12-06 Thread Tom Allison
simran wrote: From the docs... -S makes perl use the PATH environment variable to search for the script (unless the name of the script starts with a slash). Typically this is used to emulate #! startup on machines that don't support #!, in the fol-

Re: what is this?

2002-12-06 Thread simran
perldoc perlrun On Fri, 2002-12-06 at 22:39, Tom Allison wrote: simran wrote: From the docs... -S makes perl use the PATH environment variable to search On Fri, 2002-12-06 at 12:49, Tom Allison wrote: eval 'exec /usr/bin/perl -S $0 ${1+$@}' if 0; # not

Hash Question

2002-12-06 Thread Sean Rowe
I need to keep track of a user, all the web pages a user has visited, and the number of times the user visited each page. I get my information from a log file. Here's how I would like to say it programmatically: $Hash{$User}{$Page}{$NumTimesVisited} = $ANumber; Is this possible? If

Re: Hash Question

2002-12-06 Thread Mystik Gotan
I'm not very sure if it works. I'd rather concentate the whole thing. $Hash{User} = $ANumber; $Hash{Page} .= $ANumber; $Hash{NumTimesVisited} .= $ANumber; Also note that you should be using $ in your HashKey calls! -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN:

RE: Hash Question

2002-12-06 Thread Bob Showalter
-Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 9:30 AM To: Beginners@perl. org (E-mail) Subject: Hash Question I need to keep track of a user, all the web pages a user has visited, and the number of times the user visited each

RE: Hash Question

2002-12-06 Thread simran
To interate over something like: $abc{'a1'}{'b1'} = $number1 $abc{'a2'}{'b2'} = $number2 $abc{'a3'}{'b3'} = $number3 $abc{'a4'}{'b4'} = $number4 ... You can use: foreach my $key1 (keys %abc) { foreach my $key2 (keys %{$abc{$key1}}) { my $value = $abc{$key1}{$key2}

Re: Difference between $count++ and ++$count

2002-12-06 Thread stelid-6
Yes it is a differense. code: #!/usr/bin/perl -w use strict; my $hepp = 3; my $hopp; $hopp =++$hepp; print hopp: $hopp\n; $hepp = 3; $hopp = $hepp++; print hopp: $hopp\n; Mystik Gotan wrote: Hiya, is there any difference between $count++ and ++$count? Just wondering. Thanks.

RE: Difference between $count++ and ++$count

2002-12-06 Thread Wagner, David --- Senior Programmer Analyst --- WGO
$count++ - will display value then add ++$count - will add then display as in where $count = 5; printf %5d\n, $count++ ; would display 5 and $count would be 6 printf %5d\n, ++$count ; would add then display 6 Or

Re: cgi session

2002-12-06 Thread LRMK
dont usehtml file for http://www.mydomain.com/welcome.html use a cgi like http://www.mydomain.com/welcome.pl when u passing user to the page don't just redirect load that page using automated form submit so you can pass the password and username to that page too and validate there if it is wrong

Re: cgi session

2002-12-06 Thread LRMK
dont usehtml file for http://www.mydomain.com/welcome.html use a cgi like http://www.mydomain.com/welcome.pl when u passing user to the page don't just redirect load that page using automated form submit so you can pass the password and username to that page too and validate there if it is wrong

Re: Difference between $count++ and ++$count

2002-12-06 Thread Dr. Poo
On Friday 06 December 2002 11:09 am, simran wrote: Yup... In program 1 you will get $i to be 1 and then $count will be set to 2 In program 2 you will get $count to be set to 2 and then assigned to $i so now $i will also be 2. Its just a prcedence thing... Program 1 -- my

Re: Difference between $count++ and ++$count

2002-12-06 Thread Dr. Poo
Yes sir there is! And it's quite a goober if you ask me, but very useful. I'll show the difference by example. my $SOME_CONSTANT = 2; # NO MAGIC NUMBERS! (hehe) my $pre_increment = 0; my $post_increment = 0; my $pre_result = ++$pre_increment + $SOME_CONSTANT; my $post_result =

RE: Compare script fails (Solved!)

2002-12-06 Thread Michael Weber
It was a trailing space in $_ that was getting me. I changed a chomp to a chop and it now finds the string. Thanx for the tip, and the code! -Michael Patel, SamirX K [EMAIL PROTECTED] 12/05/02 05:08PM Could there be extra, non-visible characters attached to the subject coming back? You

Re: Difference between $count++ and ++$count

2002-12-06 Thread LRMK
++$count will increment $count before it is used $count++ will increment $count after it is used - Original Message - From: Yacketta, Ronald [EMAIL PROTECTED] To: 'Mystik Gotan' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 06, 2002 11:02 PM Subject: RE: Difference

Total Newbie

2002-12-06 Thread ComplexedOne
Ok I am a total newbie when it comes to perl. Could anyone please direct to a site or something that will help me learn and start programing. Any help would be great. Thanks.

RE: Difference between $count++ and ++$count

2002-12-06 Thread Yacketta, Ronald
Gah! bassackwards again :( -Original Message- From: LRMK [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:11 To: Yacketta, Ronald Cc: [EMAIL PROTECTED] Subject: Re: Difference between $count++ and ++$count ++$count will increment $count before it is used $count++ will

RE: Total Newbie

2002-12-06 Thread Beau E. Cox
Welcome! http://www.perl.org http://learn.perl.org and the many, many links posted there. Aloha = Beau. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: Total Newbie Ok I am a total newbie

Problem compiling SNMP::Util

2002-12-06 Thread Anthony . Kernan
I'm having problems compiling perl mod SNMP::Uitl, I get the following error when I do a make test. Any help would be greatly appreciated. gotgraphs# make test PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 -e 'use

Re: Difference between $count++ and ++$count

2002-12-06 Thread simran
Yup... good catch... i should run my code rather than just type it in a mail window i guess :-) Don't you mean ++$count?? my $i = $++count; print $i\n; On Sat, 2002-12-07 at 03:54, Mystik Gotan wrote: Hiya, is there any difference between $count++ and ++$count?

Regex

2002-12-06 Thread Steve Main
Hello list, I am trying to code a regex to pull out the number part of ORA-600 or 600. I have started with if ($line =~ m/^(ORA-)(\-[0-9]*)$/) { but this is obviously wrong. Anyone out there willing to get me on the right track? thanks Steve -- To unsubscribe, e-mail: [EMAIL

RE: Regex

2002-12-06 Thread Paul Kraus
Since I am not familiar with your data I will assume that it occurs anywhere is $line you want to still match. m/\s*ORA-(\d+)\s+/ Any spaces characters followed by ORA- followed by any digits 0-9 followed by any space characters. Using the () you have placed that portion of the match into

Re: Regex

2002-12-06 Thread John W. Krahn
Steve Main wrote: Hello list, Hello, I am trying to code a regex to pull out the number part of ORA-600 or 600. I have started with if ($line =~ m/^(ORA-)(\-[0-9]*)$/) { but this is obviously wrong. Yes, it is trying to match ORA--600 (two hyphens.) Anyone out there willing to get

RE: Regex

2002-12-06 Thread bengleto
m/\s*ORA-(\d+)\s+/ Correct me if I'm wrong, but wont this match fail if there are no spaces after ORA-600 I would think this is better if ($line =~ m/ORA-(\d+)/){$number = $1;} Hello list, I am trying to code a regex to pull out the number part of ORA-600 or 600. I have

Re: Compare script fails (Solved!)

2002-12-06 Thread John W. Krahn
Michael Weber wrote: It was a trailing space in $_ that was getting me. I changed a chomp to a chop and it now finds the string. It would be better to use s/\s+$// to remove trailing whitespace as it removes _only_ whitespace whereas chop will remove _any_ character from the end of the

RE: Regex

2002-12-06 Thread Paul Kraus
Ummm no your are correct. I assumed it was imbedded in other text so do this instead. m/\bORA-(\d+)\b/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 2:03 PM To: [EMAIL PROTECTED] Subject: RE: Regex m/\s*ORA-(\d+)\s+/

RE: Total Newbie

2002-12-06 Thread Dylan Boudreau
I bought the O'Reilly book Learning Perl as well as the O'Reilly Perl pocket reference. I found the learning perl book to be a great starting point and the pocket reference is invaluable for looking things up quickly. Dylan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

RE: Snagging the last page of a report

2002-12-06 Thread Paul Kraus
What is $/ Is this a made up variable or a Perl special variable? I don't recall coming across it in the learning Perl book. But I have just started the programming Perl book. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of zentara Sent: Friday,

RE: Snagging the last page of a report

2002-12-06 Thread wiggins
Perl special variable it is the input separator. From the camel (the real one): Entirely undefining $/ makes the next line input operation slurp in the remainder of the file as one scalar value. Which is how it was used in the first post. See $\ for the output separator. It is a good idea to

RE: Snagging the last page of a report

2002-12-06 Thread wiggins
p.s. see perldoc perlvar and search for INPUT_RECORD_SEPARATOR http://danconia.org On Fri, 6 Dec 2002 13:31:48 -0600, [EMAIL PROTECTED] wrote: Perl special variable it is the input separator. From the camel (the real one): Entirely

RE: Snagging the last page of a report

2002-12-06 Thread Paul Kraus
My reports seem to perform a form feed with ^L this doesn't seem to all me to find it with regexpr. Do I have to search for the ASCII equivalent? What does this translate to and where did you look to find out? Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

references in perl...

2002-12-06 Thread christopher j bottaro
hello, i'm a c/c++ programmer trying to learn perl. there are just some things that are much more easily done in a language like perl than in c/c++ i've found out...=) anyways, i'm reading a short tutorial about references. am i wrong in thinking they are like pointers in c/c++? --

RE: references in perl...

2002-12-06 Thread Timothy Johnson
Yes and no. I think that if you understand the concept of pointers, then you will be able to understand references more easily, but from what keep hearing from c/c++ people, there are differences. Perhaps someone else on the list can clarify more. One thing that Perl can do with references

RE: references in perl...

2002-12-06 Thread wiggins
On Fri, 6 Dec 2002 13:57:33 -0600, christopher j bottaro [EMAIL PROTECTED] wrote: hello, i'm a c/c++ programmer trying to learn perl. there are just some things that are much more easily done in a language like perl than in c/c++ i've found

Re: references in perl...

2002-12-06 Thread christopher j bottaro
cool thanks. and yes i'm reading perlreftut but not perlref. perlref looks a bit too exhaustive for my purposes now. perhaps in the future when i become more advanced in the ways of perl. and Timothy, yeah i'm sure there are difference of course, but i guess i was asking very generally if

Re: Newest Version

2002-12-06 Thread Christopher D . Lewis
http://www.cpan.org/src/ links from that page get you where you want. Install directions linked from perl.org are at http://dev.perl.org/perl5/news/2002/07/18/580ann/INSTALL Best regards, Chris On Thursday, December 5, 2002, at 01:40 PM, Paul Kraus wrote: I see that the newest version of

Re: Question: How do i start a program and get is pid ?

2002-12-06 Thread Hannes Krueger
I want to start a program in perl but i need to keep the pid to be able to kill it in the future. For exmple: system(top ); this would start top, but then i wouldn't be able to identify the process in order to kill it. Is there a way to do this (other than using fork) ? Have you tried to use

default C compiler

2002-12-06 Thread Tony Yi
sun solaris have come with perl, But it is use cc as default c compiler. I don't have license Sun C compiler, Can I change to C compiler to gcc. Thanks in advance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RES: Hash Question

2002-12-06 Thread Igor Sutton Lopes
You can do something like this: %url_options_hash = (times_visited=0); %url_hash = (this_url=\%url_options_hash); %usr_hash = (igor=\%url_hash); print $usr_hash{igor}-{this_url}-{times_visited}, \n; $usr_hash{igor}-{this_url}-{times_visited} = 1; print

Re: Hash Question

2002-12-06 Thread Jan Gruber
Hi, Sean List $Hash{$User}{$Page}{$NumTimesVisited} = $ANumber; Is this possible? Sure, this will work. I would decrease the hash depth a bit: $Hash{$User}{$Page} = $NumTimesVisited; If so, how would I traverse this, as I will not know before hand the values in the hash; I will need to

RE: Difference between $count++ and ++$count

2002-12-06 Thread Danny Miller
Well, it depends how you use them. Strictly speaking, ++$count is faster than $count++. say $count = 5 $num1 = $count++; #$num1 would = 5 and $count would = 6 $num2 = ++$count; #$num2 and $count would equal 6 Regards, Danny -Original Message- From: Mystik Gotan [mailto:[EMAIL

RE: default C compiler

2002-12-06 Thread Yacketta, Ronald
Yes, You can dl and install a Solaris compatible version of gcc and use it to install perl I do not have the url handy, but their is a sun page for third party (GNU type) software. -Ron -Original Message- From: Tony Yi [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 15:30

Re: Difference between $count++ and ++$count

2002-12-06 Thread Paul Johnson
On Fri, Dec 06, 2002 at 11:58:37AM -0500, Danny Miller wrote: Strictly speaking, ++$count is faster than $count++. Strictly speaking, perl will convert $count++ to ++$count if it can. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Difference between $count++ and ++$count

2002-12-06 Thread Jeff 'japhy' Pinyan
On Dec 6, Paul Johnson said: On Fri, Dec 06, 2002 at 11:58:37AM -0500, Danny Miller wrote: Strictly speaking, ++$count is faster than $count++. Strictly speaking, perl will convert $count++ to ++$count if it can. Strictly speaking, there is another major difference no one has mentioned yet

SetReadMode doc

2002-12-06 Thread Rob Das
Hi All: I'm trying to find documentation on SetReadMode. It's in CPAN module Term::ReadKey, which I can't persuade to work with Perl2exe (for NT AND Solaris AND HP-UX), so I'd like to pick out the bits of code I need and put them in my own script. First, I'd like to understand what SetReadMode is

Please help Simple Perl programm

2002-12-06 Thread Alfa rOMEO
Hi, I have a problem and search for a simple perl solution: Here are the task: Source File: Domainname TAB Username TAB Field TAB Fieldname Example: Test TAB Peter TAB FAX TAB 0112345678 I want search in the source file after a special entry in the Fieldname . Want to read the Username

Re: references in perl...

2002-12-06 Thread Jeff 'japhy' Pinyan
On Dec 6, christopher j bottaro said: i'm a c/c++ programmer trying to learn perl. there are just some things that are much more easily done in a language like perl than in c/c++ i've found out...=) anyways, i'm reading a short tutorial about references. am i wrong in thinking they are like

simple Perl prog

2002-12-06 Thread Alfa rOMEO
Hi, I have a problem and search after a simple perl solution: I want to search in a file after a Username and write all lines with this username in a new file. Example: TestTABUSERTABPeterTABFAXTAB011234567 TestTABUSERTABPeterTABPHONETAB456789 and so on Thank u for answer. Best regards

Seek tell

2002-12-06 Thread Paul Kraus
I am reading through a file. I am testing it for a regexrp. If expr is true then I save the pos of the file to a variable using tell. But it always the eof position an not the position directly before the match. Any thoughts? Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice

RE: Seek tell

2002-12-06 Thread Bob Showalter
-Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 4:42 PM To: Perl Subject: Seek tell I am reading through a file. I am testing it for a regexrp. If expr is true then I save the pos of the file to a variable using tell. But it

RE: simple Perl prog

2002-12-06 Thread Kipp, James
what have you tried ? -Original Message- From: Alfa rOMEO [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 4:36 PM To: [EMAIL PROTECTED] Subject: simple Perl prog Hi, I have a problem and search after a simple perl solution: I want to search in a file after a Username and

RE: Seek tell

2002-12-06 Thread Paul Kraus
open FILE, $filename or die Couldn't open $filename : $!\n; seek (FILE,0,2); for($i=-2048;1;$i-=2048){ seek (FILE,$i,1); $/=undef; $data=FILE; if ($data=~m/\f([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9])/){ $pos=tell (FILE); print $pos --pos\n; last; } } seek

Re: Difference between $count++ and ++$count

2002-12-06 Thread wiggins
He forgot to mention the: use Advil; $pills = new Advil(2); unless($pills-take(orally)) { sleep 40; } http://danconia.org On Fri, 6 Dec 2002 16:22:19 -0500 (EST), Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote: On Dec 6, Paul Johnson said:

RE: simple Perl prog

2002-12-06 Thread Wagner, David --- Senior Programmer Analyst --- WGO
So do you want to bring together all the data related to Peter, James, etc, so you can write another file with all the data together or you are searching for Peter and ONLY want to write out the data of Peter? Wags ;) -Original Message- From: Alfa rOMEO [mailto:[EMAIL PROTECTED]]

RE: Seek tell

2002-12-06 Thread Bob Showalter
-Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 4:50 PM To: 'Bob Showalter'; 'Perl' Subject: RE: Seek tell suggest you add: use Fcntl qw(:seek); then you can use the SEEK_* constants to make your code more readable. open FILE,

RE: Seek tell

2002-12-06 Thread Jeff 'japhy' Pinyan
On Dec 6, Paul Kraus said: if ($data=~m/\f([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9])/){ $pos=tell (FILE); print $pos --pos\n; last; } You don't want tell(FILE). You want to know WHERE in $data the pattern matched. For that, use the @- array (if you've got Perl 5.6 or

Re: Difference between $count++ and ++$count

2002-12-06 Thread Paul Johnson
On Fri, Dec 06, 2002 at 04:22:19PM -0500, Jeff 'japhy' Pinyan wrote: On Dec 6, Paul Johnson said: On Fri, Dec 06, 2002 at 11:58:37AM -0500, Danny Miller wrote: Strictly speaking, ++$count is faster than $count++. Strictly speaking, perl will convert $count++ to ++$count if it can.

Re: Difference between $count++ and ++$count

2002-12-06 Thread david
Jeff 'Japhy' Pinyan wrote: Strictly speaking, there is another major difference no one has mentioned yet (and that many people might have trouble understanding). Using $count++ returns a NUMBER OR STRING, and then increments $count's value. ++$count increments $count's value, and returns

Re: Difference between $count++ and ++$count

2002-12-06 Thread Paul Johnson
On Fri, Dec 06, 2002 at 02:46:13PM -0800, david wrote: btw, the ++$i / ++$i gives you a 1 thing behaves differently in other programming languages. For example, try the following in C++: #includeiostream.h void main{ int i=2; int j=++i/++i; coutjendl; } won't

CRLF UNIX-windows windows -unix

2002-12-06 Thread Mark Goland
Hi guys, I am trying to write a client/server app. The problem I am having, has to do with line terminators. my questions is when I connect from unix to windows do I need to set $\= CRLF and form windows to unix $\=LF ?? also is there a method to deturnime which machine is connecting to which ??.

Re: Snagging the last page of a report

2002-12-06 Thread John W. Krahn
Paul Kraus wrote: My reports seem to perform a form feed with ^L this doesn't seem to all me to find it with regexpr. Do I have to search for the ASCII equivalent? What does this translate to and where did you look to find out? The form feed character is reresented by \f (or \cL or \014 or

Re: Difference between $count++ and ++$count

2002-12-06 Thread david
Paul Johnson wrote: But it might. The behaviour is undefined. The compiler may do as it will. Google for sequence point if you want to find out more. The behaviour in Perl is undefined too, but more in the sense that the behaviour has not been defined rather than that the behaviour has

RE: Regex

2002-12-06 Thread Steve Main
Thanks Gang, I ended up with if ( $line =~ m/^(ORA-\d+):/ ) { -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:11 AM To: [EMAIL PROTECTED]; Perl Subject: RE: Regex Ummm no your are correct. I assumed it was imbedded in other text

This perl script does nothing....

2002-12-06 Thread Jonathan Daniels
Hi, Hopefully this isn't too stupid of a question. Thanks in advance for any help. Can anyone tell me why, when I feed a file of the following format Date,Time,Action,Result,Client,Server,From,To,To,To,...,Subject,Size,SMTPID 20021128,9,Message Accepted,,10.0.0.1,,[EMAIL PROTECTED],[EMAIL

Re: Difference between $count++ and ++$count

2002-12-06 Thread Dr. Poo
HAHAHAHAHAHA! -Chris On Friday 06 December 2002 03:51 pm, [EMAIL PROTECTED] wrote: He forgot to mention the: use Advil; $pills = new Advil(2); unless($pills-take(orally)) { sleep 40; } http://danconia.org On Fri, 6