in reply to Split Not Working Correctly?
G'day Hans Castorp,
See the documentation for split.
There's nothing fundamentally wrong with the syntax you're using but $call may be an issue. Look at this test code:
#!/usr/bin/env perl -l use strict; use warnings; my %call_subs = ( "PN" => "English, Film, Theater", ); # Your line gives "Global symbol "$call" requires explicit package nam +e ...": #my @subjects = split(/, /, $call_subs{$call}); # This works: my @subjects = split(/, /, $call_subs{PN}); print for @subjects;
Output:
English Film Theater
You're probably quite correct in saying: "I realize I may not be giving enough information here". Try to write a small script that just reproduces the problem. The guidelines in "How do I post a question effectively?" should help you with this.
I found parts of your description difficult to follow. For example, you write "instead of PN being assigned to English, Film, and Theater" but nowhere do you perform any such assignment.
The problem may be a misunderstanding of what split actually does. An indication of actual vs. expected results will help in providing an answer (also explained in the guidelines I linked to above).
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split Not Working Correctly?
by Hans Castorp (Sexton) on Jan 08, 2014 at 14:53 UTC | |
|
Re^2: Split Not Working Correctly?
by Hans Castorp (Sexton) on Feb 06, 2014 at 17:20 UTC |