Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: simple ques...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 10997 of 11065
Post > Topic >>

Re: simple question

by jialinli1981@[EMAIL PROTECTED] (Jialin Li) Apr 27, 2008 at 12:03 PM

------=_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--




 1 Posts in Topic:
Re: simple question
jialinli1981@[EMAIL PROTE  2008-04-27 12:03:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 21:43:55 CDT 2008.