Ing. Branislav Gerzo wrote:
Hello beginners@perl.org,
Hello,
anyone could me help with:
use strict;
use warnings;
my %kw = ();
my $kw = \%kw;
for my $cat (split(/\//, 'something/other/foo/bar')) { $kw->{cnt}++;
$kw->{cat${kw->{cnt}}} = $cat }
I get: Can't use bareword ("kw") as a HASH ref while "strict refs" in
use..
The goal is to get something like:
$kw->{cat1} = 'something',
$kw->{cat2} = 'other',
$kw->{cat3} = 'foo',
$kw->{cat4} = 'bar'
anyone?
my $string = 'something/other/foo/bar';
my $count;
my $kw = { map { 'cat' . ++$count, $_ } split /\//, $string };
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>