Re: What is the function value in perl?

2008-01-12 Thread Beginner
I know how to read the key from the keyboard now but when I use the Readkey to read the F3 key, it only show 0 for the key, and it is same as other Fx key... Is that any other way to find other those Fx key ASCII value in perl? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: What is the function value in perl?

2008-01-12 Thread Peter Scott
On Fri, 11 Jan 2008 21:06:38 -0800, Beginner wrote: I know how to read the key from the keyboard now but when I use the Readkey to read the F3 key, it only show 0 for the key, and it is same as other Fx key... Is that any other way to find other those Fx key ASCII value in perl? Go to

uploading a file with perl---kueri: ------------4CyrMz2ZeGIClwYfFsVdcv Content-Disposition: form-data; name=level asda ------------4CyrMz2ZeGIClwYfFsVdcv Content-Disposition: form-data; name=major

2008-01-12 Thread Patrik Hasibuan
Dear my friends... I am still new in perl. I am writing perl-cgi application for uploading a file. I did chmod 777 ../../artikel. But I get weird displayed message: ueri: 4CyrMz2ZeGIClwYfFsVdcv Co î 6êÎ]Ë kšfþx·¾ ðfS4M3º {½‡Óöù³®�¯3çýGèBù= „¬È›øRƒ. ƒ ÿƒm‡îø'-n

Re: perl for uploading file shows weird characters.

2008-01-12 Thread Gunnar Hjalmarsson
[ please do not multi-post! ] Patrik Hasibuan wrote: I am writing perl-cgi application for uploading a file. I did chmod 777 ../../artikel. But I get weird displayed message: ueri: 4CyrMz2ZeGIClwYfFsVdcv Co î 6êÎ]Ë kšfþx·¾ ðfS4M3º {½‡Óöù³®�¯3çýGèBù= „¬È›øRƒ. ƒ

Re: Q: how to push into array

2008-01-12 Thread ciwei
thanks for the reply. I was not able to figure out how the code works. I have commented the code below. can you help explain it a bit? thanks. On Jan 10, 9:41 am, [EMAIL PROTECTED] (Chas. Owens) wrote: __DATA__              DEV01-HBA0_DMX1-13CA  -- begin of record               WWN:

space in variable referencing

2008-01-12 Thread ciwei
Question from a newbie: how to properly use space when reference to variables, array, hash etc. please see the code below: why the first line, second, and third line all output differiently. thanks. ciwei code below == #!/usr/bin/perl my %ttys =(); open ( WHO, who|) or die can;t

Re: installing Math::Complex

2008-01-12 Thread sisyphus
On Jan 12, 6:06 am, [EMAIL PROTECTED] (Anjan Purkayastha) wrote: i too am having problems installing the Math::Complex module. Math::Complex (and Math::Trig) has been part of core perl for quite some time. I would expect that you already have it. Cheers, Rob -- To unsubscribe, e-mail: [EMAIL

Re: Why doesn't this work: trinary operator?

2008-01-12 Thread davidfilmer
On Jan 11, 1:16 pm, [EMAIL PROTECTED] (Kevin Zembower) wrote: $type eq unknown ? $type=human : $type=both; You're trying to use the trinary like you would an if-then-else. You want to instead use it in an assignment: $type = ($type eq 'unknown') ? 'human' : 'both'; -- The best way to get a

Re: space in variable referencing

2008-01-12 Thread Tom Phoenix
On Jan 11, 2008 3:03 PM, ciwei [EMAIL PROTECTED] wrote: Question from a newbie: how to properly use space when reference to variables, array, hash etc. Don't put any spaces inside a variable name, especially when interpolating it. print first line : $user = @{$ttys {$user}} \n; print second

Re: Q: how to push into array

2008-01-12 Thread Jenda Krynicky
From: ciwei [EMAIL PROTECTED] On Jan 10, 9:41 am, [EMAIL PROTECTED] (Chas. Owens) wrote: __DATA__              DEV01-HBA0_DMX1-13CA  -- begin of record               WWN: 1000C934A35B               WWN: 5006048ACAFE1E4C -- end of record               EST01_HBA1_STK_TAPES1 --

length in bytes not characters

2008-01-12 Thread reader
How do we get the length of a variable in bytes? I see the length function returns length in characters. unless you (From perldoc -f length): use do { use bytes; length(EXPR) } Nothing there would seem to indicate it cannot be used to get the length in characters or bytes of an array.

Re: length in bytes not characters

2008-01-12 Thread Rob Dixon
[EMAIL PROTECTED] wrote: How do we get the length of a variable in bytes? I see the length function returns length in characters. unless you (From perldoc -f length): use do { use bytes; length(EXPR) } Nothing there would seem to indicate it cannot be used to get the length in

Re: length in bytes not characters

2008-01-12 Thread Chas. Owens
On Jan 12, 2008 12:29 PM, Rob Dixon [EMAIL PROTECTED] wrote: snip My best guess at what you're looking for is the total number of bytes in all the elements of an array. This can be achieved by manually accumulating the lengths: use strict; use warnings; my @ar = qw(one two three

Re: length in bytes not characters

2008-01-12 Thread reader
Chas. Owens [EMAIL PROTECTED] writes: It is important to note that this returns the number of characters, not the number of bytes (in this case they are the same since all of the UTF-8 characters in your string take up only one byte). You need to use the bytes pragma to force length to

Re: length in bytes not characters

2008-01-12 Thread reader
Rob Dixon [EMAIL PROTECTED] writes: which outputs char19. If you're hoping for something different from this then perhaps you would let us know. Sorry if I was unclear as to what I was after. Yes that was it. 'bytes' is a pragma, and documentation on it can be retrieved in the same way as

Re: length in bytes not characters

2008-01-12 Thread Chas. Owens
On Jan 12, 2008 1:50 PM, [EMAIL PROTECTED] wrote: Rob Dixon [EMAIL PROTECTED] writes: which outputs char19. If you're hoping for something different from this then perhaps you would let us know. Sorry if I was unclear as to what I was after. Yes that was it. 'bytes' is a pragma,

Re: length in bytes not characters

2008-01-12 Thread reader
Chas. Owens [EMAIL PROTECTED] writes: As you can see it is normal Perl. The real magic happens inside the length and other functions. They check the value of the hints global variable ($^H) and change their behavior if the use bytes bit is set. In Perl 5.10 we have been given the ability

Re: space in variable referencing

2008-01-12 Thread John W. Krahn
ciwei wrote: Question from a newbie: how to properly use space when reference to variables, array, hash etc. please see the code below: why the first line, second, and third line all output differiently. thanks. ciwei code below == #!/usr/bin/perl The next two lines should be:

perl for uploading file shows weird characters.

2008-01-12 Thread Patrik Hasibuan
Dear my friends... I am still new in perl. I am writing perl-cgi application for uploading a file. I did chmod 777 ../../artikel. But I get weird displayed message: ueri: 4CyrMz2ZeGIClwYfFsVdcv Co î 6êÎ]Ë kšfþx·¾ ðfS4M3º {½‡Óöù³®�¯3çýGèBù= „¬È›øRƒ. ƒ ÿƒm‡îø'-n

Re: perl for uploading file shows weird characters.

2008-01-12 Thread Gunnar Hjalmarsson
[ please do not multi-post! ] Patrik Hasibuan wrote: I am writing perl-cgi application for uploading a file. I did chmod 777 ../../artikel. But I get weird displayed message: ueri: 4CyrMz2ZeGIClwYfFsVdcv Co î 6êÎ]Ë kšfþx·¾ ðfS4M3º {½‡Óöù³®�¯3çýGèBù= „¬È›øRƒ. ƒ

Re: printing sentences on the same line

2008-01-12 Thread Ryan
This approach did the job. Thanks. --Chris Ryan Gunnar Hjalmarsson wrote: Chas. Owens wrote: On Jan 6, 2008 7:48 PM, Ryan [EMAIL PROTECTED] wrote: I have a small piece of a program which loops through lines of data, using the while construct, one line at a time, and prints different

Re: printing sentences on the same line

2008-01-12 Thread John W. Krahn
Ryan wrote: Gunnar Hjalmarsson wrote: One way to do that is to store the sentences in an output array instead of printing them directly. Within the while loop: push @output, ...; And then: chomp @output; print @output\n; This approach did the job. Thanks. A more

Re: printing sentences on the same line

2008-01-12 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Ryan wrote: Gunnar Hjalmarsson wrote: One way to do that is to store the sentences in an output array instead of printing them directly. Within the while loop: push @output, ...; And then: chomp @output; print @output\n; This approach did the job.

Re: printing sentences on the same line

2008-01-12 Thread John W. Krahn
Gunnar Hjalmarsson wrote: John W. Krahn wrote: Ryan wrote: Gunnar Hjalmarsson wrote: One way to do that is to store the sentences in an output array instead of printing them directly. Within the while loop: push @output, ...; And then: chomp @output; print @output\n; This

Re: printing sentences on the same line

2008-01-12 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Gunnar Hjalmarsson wrote: John W. Krahn wrote: A more efficient method is to read and write one line at a time: $\ = ' '; # set Output Record Separator to a space while ( ) { $\ = \n if eof; chomp; print; } That may be an efficient solution to some

Re: printing sentences on the same line

2008-01-12 Thread John W. Krahn
Gunnar Hjalmarsson wrote: John W. Krahn wrote: Could you please explain how the code I posted does not accomplish the OP's objectives or is inefficient? Well, to me it seems like the pre-defined sentences, including the undesired newline symbols, are not part of the data that is read by