var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: problem with the split function
hi, I'm a newbee on perl and I have a problem using the simple function split
I want to use a delimiter as a parameter given by a comand line( i use getopts, and it works ). I store it in the scalar $delimiter in my script, and I want to split a line with it.
I tried several syntaxes but none is working :
@array = split ( /$delimiter/, $line );
@array = split ( /"$delimiter"/, $line );
@array = split ( $delimiter, $line );
@array = split ( '$delimiter', $line );
@array = split ( /\$delimiter/, $line );
when i do a print $delimiter, it prints the right thing : | (for example )
and when I do : @array = split ( /\|/, $line ); it works well !
but 'cause the delimiter can be different : or ; I have to pass It to my script as a parameter
Has anybody an idea about the split syntax , in that case ?
I've been searchin' in the perl cookbook, but nothing helps
I need help !
and the (easy) answer is :
@array = split ( /$delimiter/, $line);