Deepak Barua wrote:
>
> On 1/3/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
>> Deepak Barua wrote:
>>
>> > I want to use a scalar variable with OR "|" operator embedded in
>> > the variable in a statement like
>> > $start_pattern = "\/\* \| \/\/";
>> >
>> > if(m/$start_pattern/ || $continue == 1) {
>> > $chosen_pattern = $&;
>> > Please inform me on how it is supposed to work..?
>>
>> my $start_pattern = qr!/\*|//!;
>>
>> if ( /($start_pattern)/ || $continue == 1 ) {
>> $chosen_pattern = $1;
>
> I don't understand the script seems very cryptic, could
> you explain
> my $start_pattern = qr!/\*|//!;
I assumed that you wanted to match EITHER '/*' OR '//'. The qr// operator
creates a regular expression:
perldoc perlop
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/