Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^3: Nested Data Structures for Dummies?

by ikegami (Pope)
on Apr 15, 2010 at 01:03 UTC ( #834805=note: print w/replies, xml ) Need Help??

in reply to Re^2: Nested Data Structures for Dummies?
in thread Nested Data Structures for Dummies?

You did exactly what I suggested you don't do. Don't look at the whole. These are the things you actually need to do:

  • Identify if a neighbourhood name starts with 'k'.
  • Get a city's list of neighbourhoods.
  • Get a province's list of cities.
  • Identify if a province's name starts with 'c'.
  • Get a country's list of provinces.
  • Get a list of countries.

They're all independent. Nothing in there even suggests that you have a nested structure in memory.

The hard part:

print("$country_name/$province_name/$city_name/$neighbourhood_name\n") if $neighbourhood_name =~ /^k/i;

Replies are listed 'Best First'.
Re^4: Nested Data Structures for Dummies?
by jedikaiti (Hermit) on Apr 15, 2010 at 17:38 UTC

    Some days, it's hard to make myself do that. Thank you.

    Swiss Army Nerd

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://834805]
[1nickt]: kgb not quite as simple as ... and ...; are interchangeable. There are edge cases, shown in perlsyn.
[1nickt]: Hm well actually I guess it's not the trailing semi-colon that's at issue there, it's disambiguation between the ellipsis and the binary flip-flop
[1nickt]: Although the example given does not produce an error as stated, on my perl.
[1nickt]: perl -wE 'say for map { ... } 1..3;' # "Unimplemented at -e line 1" ... <c>perlsyn says that should throw a syntax error...
[karlgoethebier]: 1nickt: "Edge cases..." Yes, it seems so. Thanks Nick

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2017-11-18 19:46 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (277 votes). Check out past polls.