T
tdelov
Hi.
I was wondering if anyone could offer any helps in a string conversion.
given the following line (this is not a real lp command)
$line = "lp -x -olandscape -ol99 -olm -x";
I'm wondering how would I change "-ol99" to "-ol=99" but not change
-olm
If I do something like this:
$line =~ s/-ol/-ol=/; # this will change -olm
How could I check the if there is a number after the "ol" characters
and only apply the change to that part of the string?
I considered using split along spaces, but prefer an actual string
substitution that works with the whole line rather than processing each
"word" in the line and then joining it again. I have to process many
files and there could be other complications if I start splitting up
each line on spaces.
Thanks.
I was wondering if anyone could offer any helps in a string conversion.
given the following line (this is not a real lp command)
$line = "lp -x -olandscape -ol99 -olm -x";
I'm wondering how would I change "-ol99" to "-ol=99" but not change
-olm
If I do something like this:
$line =~ s/-ol/-ol=/; # this will change -olm
How could I check the if there is a number after the "ol" characters
and only apply the change to that part of the string?
I considered using split along spaces, but prefer an actual string
substitution that works with the whole line rather than processing each
"word" in the line and then joining it again. I have to process many
files and there could be other complications if I start splitting up
each line on spaces.
Thanks.