Hi,
The following regex removes white space from head and tail of the line.
perl -pe 's/^\s+|\s+$//g'
How come it removes both ? It should just remove front because of presence of or (|).
Looking it in boolean context, remove space from front or remove space from end.
The first substitution evaluates to be true then how come it evaluates the second substitution after "|" ?
Does presence of global substitution forces it ?
thanks,
The following regex removes white space from head and tail of the line.
perl -pe 's/^\s+|\s+$//g'
How come it removes both ? It should just remove front because of presence of or (|).
Looking it in boolean context, remove space from front or remove space from end.
The first substitution evaluates to be true then how come it evaluates the second substitution after "|" ?
Does presence of global substitution forces it ?
thanks,