in reply to problem with split function

Anonymous Monk,
I believe quotemeta will solve your problem.
#!/usr/bin/perl -w use strict; # Your code $delimiter = quotemeta $delimeter; my @array = split ( /$delimiter/, $line );
If this does not correct your problem, please provide the sample data and the whole block of code you are trying.

Cheers - L~R

Replies are listed 'Best First'.
Re: Re: problem with split function
by jclaudio (Initiate) on Oct 20, 2003 at 17:03 UTC
    YES !! It works !! quotemeta.. I could have been searchin' for this tip for years... thank you very much for your pretty fast and right answer ! that's what I call reactivity ! you rock !!

      And to make that even easier, use \Q in your regex to invoke quotemeta inline. No need to alter $delimiter or use an intermediary variable.

      split /\Q$delimiter/, ...