![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re: How can I remove 0 from first line and empty space from the start of the following line and join themby arturo (Vicar) |
on Oct 16, 2002 at 02:28 UTC ( #205613=note: print w/replies, xml ) | Need Help?? |
Basic idea:
For the second part, you can use a regular expression. Here's a hint: /^a/ matches an a at the beginning of a string. Here's another hint: \s{7,} matches seven whitespace (space, tab, newline) characters. The general syntax for a search-and-replace (substitution) pattern match is $string =~ s/tick/arthur/;, and the /g modifier on the end of a regular expression tells the system to perform each match it finds (instead of just the first). The rest is left as an exercise for the reader. Study materials: perlre, perlretut. HTH Update theorbtwo pointed out I hadn't closed my ordered list tag. If not P, what? Q maybe?
In Section
Seekers of Perl Wisdom
|
|