Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Lunchtime homework is always fun when you are learning all of this stuff (like I am), and dvergin has already done all of the hard work / taken us 90% of the way there. So here is a pass at with most of what he did then just played with the grep statement to get it to work as discussed in the thread:

#!/usr/bin/perl -w use strict; open(DATA,"D:/JUNK/commafile.csv"); my @friends; my @raw_list = <DATA>; chomp @raw_list; for (@raw_list) { my @bits = split(/,/, $_); my $sucker= {FIRSTNAME => $bits[0], LASTNAME => $bits[1], HAIRCOLOR => $bits[2]}; push @friends, $sucker; } my @real_friends = grep { lc(substr($_->{FIRSTNAME},0,1)) eq "j" && $_->{HAIRCOLOR} eq "brown" } @friends; foreach (@real_friends) { print "Only real friends have \'$_->{HAIRCOLOR}\' hair "; print " and names which begin with 'j' like my friend "; print "\'$_->{FIRSTNAME} $_->{LASTNAME}\'\n"; if (($_->{FIRSTNAME} eq "John") && ($_->{LASTNAME} eq "Kennedy")) { print " Hey 'nandaya' you Novice level chump, "; print "I know John Kennedy, \n"; print " I worked with John Kennedy, and 'nandeya', "; print "you're no friend of John Kennedy.\n"; } } __DATA__ John,Brown,red Fred,Flintstone,black Jane,Brown,blond Betty, Rubble,black John,Kennedy,brown Jodi,Brown,brown Bill,Black,blond June,Green,brown John,McEnroe,brown Erin,White,brown

nandeya

In reply to Re: Storing Info by nandeya
in thread Storing Info by sickboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found