Using a hash

Posted on 2000-02-20
Last Modified: 2010-03-05

I am using this code:

@data = <DIRADMIN>;

#Fill the hash with translated language
%lang = map { split /\|/ } @data;
$r_la = \%lang;

The file test.lang contains:

Notax|geen BTW

When I now call the following:

<a href="test.html>r_la->{'Total'}</a>

The output is:
<a href="test.html>Totaal

After "Totaal" I get an break.
How to make it not to break the line!!!

greeting Michel
Question by:mmcw
1 Comment

Accepted Solution

time4tea earned 100 total points
ID: 2539953
It's nothing to do with the fact thats its a hash, but that you are not getting rid of the \n character from your input file....


open ( F, "test.lang") || die "Can't open file $!\n";
while (<F>) {
      my ($t1, $t2) = split(/\|/);
      $lang{$t1} = $t2;

Should work....


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now