Re: interpolated strings

2004-03-30 Thread Adam
Bryan, I'm no pro, but I can help a bit. You interpolate variables in a double-quote "". my($name) = 'Adam'; print("My name is $name\n"); # Prints `My name is Adam` with a return at the end. or more to your question my($name); chomp($name = ); print("His name is $nam

Re: interpolated strings

2004-03-29 Thread John W. Krahn
Bryan Harris wrote: > > Wow, Johns, thanks for the tips... I'm going to have to study that map > command very closely. Either way you've answered my question, thanks! > > Only one thing to add-- you ask: > > >>chomp $newtxt; > >>print $newtxt, "\n"; > > > > Why remove "\n" in one line

Re: interpolated strings

2004-03-29 Thread John W. Krahn
Wc -Sx- Jones wrote: > > Bryan Harris wrote: > > > > I did this because I want to make sure I end with a "\n", but I don't want > > an extra one if one is already there. I guess I could've also done a: > > > > $newtxt =~ s/([^\n])$/$1\n/; > > This is clearer: > > $newtext = "Hello\n\n\n"; > $ne

Re: interpolated strings

2004-03-29 Thread Jimstone77
while () { $counter++; } I know this is probably simple, but how would I increment by 20? In other words, $counter would increment 1 time for every twenty lines of the file? Any help would be appreciated.

Re: interpolated strings

2004-03-28 Thread WC -Sx- Jones
Bryan Harris wrote: $newtxt =~ s/([^\n])$/$1\n/; This is clearer: $newtext = "Hello\n\n\n"; $newtext =~ s/\n+/\n/; print $newtext; -Sx- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: interpolated strings

2004-03-28 Thread Bryan Harris
Wow, Johns, thanks for the tips... I'm going to have to study that map command very closely. Either way you've answered my question, thanks! Only one thing to add-- you ask: >>chomp $newtxt; >>print $newtxt, "\n"; > > Why remove "\n" in one line and then add it back on the next line

Re: interpolated strings

2004-03-28 Thread John W. Krahn
Bryan Harris wrote: > > Is there a way to interpolate strings that the user enters? > > I'm writing a filter (pipe-cat = pat) that lets you add text to the front or > end of some piped data: > > echo "2" | pat "1" - "3\n" > > The "-" represents the piped data, so the above should print: > > %

Re: interpolated strings

2004-03-28 Thread John McKown
On Sun, 28 Mar 2004, Bryan Harris wrote: > > > Is there a way to interpolate strings that the user enters? > > I'm writing a filter (pipe-cat = pat) that lets you add text to the front or > end of some piped data: > > echo "2" | pat "1" - "3\n" > > The "-" represents the piped data, so the ab