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
> >
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
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
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
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";
> prin
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_HB
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
[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 cha
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 tw
"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 t
Rob Dixon <[EMAIL PROTECTED]> writes:
> which outputs "char<19>".
>
> 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
>
On Jan 12, 2008 1:50 PM, <[EMAIL PROTECTED]> wrote:
> Rob Dixon <[EMAIL PROTECTED]> writes:
>
> > which outputs "char<19>".
> >
> > 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.
>
> > '
"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
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:
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
[ 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ƒ.
&ƒ
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 construct, one line at a time, and prints different
pre-defined
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 effici
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. Than
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
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
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 the
22 matches
Mail list logo