Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

string value assignment

by abidq (Initiate)
on May 14, 2011 at 10:52 UTC ( [id://904805]=perlquestion: print w/replies, xml ) Need Help??

abidq has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: string value assignment
by GrandFather (Saint) on May 14, 2011 at 11:00 UTC

    How about you show us what you have tried? This has a rather homework look about it and despite that has lost a lot in translation. Without seeing the code you have tried already it's not at all clear where you are having trouble nor even what you are wanting to achieve.

    You'll find it helps to get help here if you provide a little sample data, the code you have written in an attempt to process the data and both the output you get and the output you expect.

    True laziness is hard work
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: string value assignment
by Anonymous Monk on May 14, 2011 at 11:00 UTC
Re: string value assignment
by ciderpunx (Vicar) on May 14, 2011 at 11:14 UTC
    Its normally helpful if you post your code and describe what you are having difficulty with. But I'm at a loose end so try:
    #!/usr/bin/perl use warnings; use strict; open (IN, 'first.txt') or die ("crap! $!"); my @first = <IN>; close IN; open (IN, 'second.txt') or die ("crap! $!"); my @second = <IN>; close IN; my %h; my $i=0; for (@second) { ($h{'A'},$h{'B'},$h{'C'}) = split / /,$_; my @keys = split //,$first[$i]; my $total = 0; for(@keys) { $total+= int($h{$_}) unless /\n/; } $total/=scalar(@keys) if($total); print "$i: $total \n"; $i++; }


    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: string value assignment
by BrowserUk (Patriarch) on May 16, 2011 at 10:03 UTC

    What do you want at 3pm? And 7am?

      A lock-in till 3pm with the possibilty of going on till 7pm ;-)
        if they knew how t write progs ...wouldn't they first debug this weird website.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://904805]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found