RE: Split Function With Expression
by Nikhil Bharucha other posts by this author
Feb 18 2005 7:45AM messages near this date
RE: Runtime Errors in /PerlApp/utf8_heavy.pl
|
Split Function With Expression
Aaah. I am creating an OO Perl Module that I will instantiate and the
method (sub) which will have the split function could have $foo change
-- kind of the purpose... I read that too about $foo not changing but
it didn't register, Thanks.
I am building a generic Ini file loader (to a hash which I return) and I
wanted to make it flexible to work with a delimiter passed by the method
caller. I guess I have to limit the choice. This is not a problem for
my use now but I was thinking about reuse in the future.
-----Original Message-----
From: $Bill Luebkert [mailto:dbecoll@[...].net]
Sent: Friday, February 18, 2005 10:11 AM
To: Bharucha, Nikhil
Cc: pdk@[...].com
Subject: Re: Split Function With Expression
Bharucha, Nikhil wrote:
> Hi,
>
>
>
> I finally have a need NOT to hardcode a pattern in a split function.
> However, it doesn't seem to be working:
>
>
>
> From CPAN "The pattern |/PATTERN/| may be replaced with an expression
to
> specify patterns that vary at runtime. (To do runtime compilation only
> once, use |/$variable/o|.)"
>
> Therefore this should work (right?):
I don't know - did it ? Don't use /o unless you're sure $foo won't
change.
> split (/$foo/o, $bar)
Don't ask questions without trying them first - then if it fails provide
the smallest test snippet you can that duplicates the error for you.
--
,-/- __ _ _ $Bill Luebkert
Mailto:dbecoll@[...].net
(_/ / ) // // DBE Collectibles Mailto:dbe@[...].com
/ ) /--< o // // Castle of Medieval Myth & Magic
http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
PDK mailing list
PDK@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
|