How are you assigning @subjects to PN? Where does the value of $call come from?

use strict; use warnings; use Data::Dumper; my @subjects = split /, /, "foo, bar, baz"; my %lc_class; $lc_class{PN} = \@subjects; print Dumper \%lc_class;

Update

Here is a more extensive example of splitting and storing...

use strict; use warnings; use Data::Dumper; # a home for our results my %lc_class; # read data from the end of the script # a handy testing tool while (my $line = <DATA>) { chomp $line; # remove newline # split each line on =, optionaly surounde by space, max 2 parts my ($class, $subj) = split /\s*=\s*/, $line, 2; # split the subject on , (optional space) my @subjects = split /\s*,\s*/, $subj; # store a reference to the @subjects array $lc_class{$class} = \@subjects; } # show and tell print Dumper \%lc_class; __DATA__ PN = this, that, the other GN = something RT = test with some space, testwithout, And more space
Output:
$VAR1 = { 'RT' => [ 'test with some space', 'testwithout', 'And more space' ], 'PN' => [ 'this', 'that', 'the other' ], 'GN' => [ 'something' ] };

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

In reply to Re: Split Not Working Correctly? by Random_Walk
in thread Split Not Working Correctly? by Hans Castorp

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.