------=_Part_4184_31040007.1209315813386
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
run command:
perldoc perldsc
use strict;
use warnings;
are two pragmas, strict will force you to declare variables with my
warnings will produce useful warnings
please see
perldoc -f use
On Sun, Apr 27, 2008 at 11:46 AM, Alex Goor <a_goor@[EMAIL PROTECTED]
> wrote:
> thank you so much for your fast answer.
>
> what do you mean by perldoc perldsc? how do i get that?
>
> what is "use strict" and "use warnings"
>
> sorry to bother you and thanks again!
>
> ----- Original Message ----
> From: "Li, Jialin" <jialinli1981@[EMAIL PROTECTED]
>
> To: Alex Goor <a_goor@[EMAIL PROTECTED]
>
> Sent: Sunday, April 27, 2008 12:43:47 PM
> Subject: Re: simple question
>
> you should use hash, see more detail
> perldoc perldsc
>
>
> use strict;
> use warnings;
> my %hash_symbol;
>
> while (my $message = <>) {
> ++$hash_symbol( substr($message,17,6) );
> }
>
> my @[EMAIL PROTECTED]
= keys %hash_symbol;
>
>
>
> On Sun, Apr 27, 2008 at 11:36 AM, Alex Goor <a_goor@[EMAIL PROTECTED]
> wrote:
>
> > i have a data set of stock orders and i want to count the number of
> > unique stock symbols in the set.
> >
> > i have turned the data set into an array and based on the message
spec,
> > i can identify the stock symbols. but i don't know how to make sure
i'm
> > only counting unique ones.
> >
> > i had thought to do an if statement along the lines of
> >
> >
> > $symbolset = "@[EMAIL PROTECTED]
";
> > if $symbolset !~ /substr($message,17,6)/ #if the array doesn't
contain
> > the new symbol
> > {
> > #then add it to the array
> > push (@[EMAIL PROTECTED]
"substr($message,17,6)
> >
> > }
> >
> > substr($message,17,6) is the symbol info within each line of the array
> > of the data set.
> >
> > the problem is that that doesn't work!
> >
> > does anyone have any ideas how to do this?
> >
> >
> > --
> > To unsubscribe, e-mail: beginners-unsubscribe@[EMAIL PROTECTED]
> > For additional commands, e-mail: beginners-help@[EMAIL PROTECTED]
> > http://learn.perl.org/
> >
> >
> >
>
------=_Part_4184_31040007.1209315813386--


|