Stick Lines and Dividers Between Text

Stick Lines and Dividers Between Text

am 02.02.2007 08:43:14 von vjp2

is that x or *???

perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
< %1 >%1

Re: Stick Lines and Dividers Between Text

am 02.02.2007 12:46:28 von anno4000

wrote in comp.lang.perl.misc:
> is that x or *???

Is what x or *?

> perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
> < %1 >%1

There is no "*" in that, so it must be "x". What is your question?

Anno

Re: Stick Lines and Dividers Between Text

am 02.02.2007 12:46:28 von anno4000

wrote in comp.lang.perl.misc:
> is that x or *???

Is what x or *?

> perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
> < %1 >%1

There is no "*" in that, so it must be "x". What is your question?

Anno

Re: Stick Lines and Dividers Between Text

am 02.02.2007 12:52:33 von Michele Dondi

On Fri, 2 Feb 2007 07:43:14 +0000 (UTC), vjp2@panix.com wrote:

>is that x or *???
>
>perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
>< %1 >%1

I suppose it's C, the repetition operator. What would you expect a
multiplication to do there?!?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 02.02.2007 12:52:33 von Michele Dondi

On Fri, 2 Feb 2007 07:43:14 +0000 (UTC), vjp2@panix.com wrote:

>is that x or *???
>
>perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
>< %1 >%1

I suppose it's C, the repetition operator. What would you expect a
multiplication to do there?!?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 02.02.2007 18:10:21 von John Bokma

vjp2@panix.com wrote:

> is that x or *???
>
> perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37}
> $_.="\n"' < %1 >%1

x

"-" x 37 is an expression that results in

----------------- ... ---
<-- 37 characters -->

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/

Re: Stick Lines and Dividers Between Text

am 02.02.2007 18:10:21 von John Bokma

vjp2@panix.com wrote:

> is that x or *???
>
> perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37}
> $_.="\n"' < %1 >%1

x

"-" x 37 is an expression that results in

----------------- ... ---
<-- 37 characters -->

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/

Re: Stick Lines and Dividers Between Text

am 03.02.2007 10:06:41 von Joe Smith

vjp2@panix.com wrote:
> is that x or *???
> {$_.="-" x 37}

Did you try testing it?

C:\>perl -le "print 12 * 4; print 12 x 4"
48
12121212

Clearly x is appropriate for strings like "-" and "=".
-Joe

Re: Stick Lines and Dividers Between Text

am 03.02.2007 10:06:41 von Joe Smith

vjp2@panix.com wrote:
> is that x or *???
> {$_.="-" x 37}

Did you try testing it?

C:\>perl -le "print 12 * 4; print 12 x 4"
48
12121212

Clearly x is appropriate for strings like "-" and "=".
-Joe

Re: Stick Lines and Dividers Between Text

am 06.02.2007 18:30:40 von vjp2.at

What is
$_.=
? Concatenate what follows to a new line immediately after the current?
Is it possible the equal sign is redundant?

Many thanks. I made a bit of progress. At least it doesn't bomb!

Using DOS GNU v4. I had to use " " to enclose the expression.
And change the internal "" to `` not ''.
But I'm getting a no-op. Is it possible it resets $. for every line?


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 06.02.2007 18:30:40 von vjp2.at

What is
$_.=
? Concatenate what follows to a new line immediately after the current?
Is it possible the equal sign is redundant?

Many thanks. I made a bit of progress. At least it doesn't bomb!

Using DOS GNU v4. I had to use " " to enclose the expression.
And change the internal "" to `` not ''.
But I'm getting a no-op. Is it possible it resets $. for every line?


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 06.02.2007 19:42:58 von Jim Gibson

In article ,
wrote:

> What is
> $_.=

It is equivalent to

$_ = $_ .

> ? Concatenate what follows to a new line immediately after the current?

"Append what follows to $_, assigning the result to $_"

> Is it possible the equal sign is redundant?

No. Without the equal sign, "$_ . " will concatenate what follows to
the value of $_ in a temporary value, but will not assign the result
back to $_.

See 'perldoc perlop' and search for "Assignment Operators"

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Re: Stick Lines and Dividers Between Text

am 06.02.2007 19:42:58 von Jim Gibson

In article ,
wrote:

> What is
> $_.=

It is equivalent to

$_ = $_ .

> ? Concatenate what follows to a new line immediately after the current?

"Append what follows to $_, assigning the result to $_"

> Is it possible the equal sign is redundant?

No. Without the equal sign, "$_ . " will concatenate what follows to
the value of $_ in a temporary value, but will not assign the result
back to $_.

See 'perldoc perlop' and search for "Assignment Operators"

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Re: Stick Lines and Dividers Between Text

am 06.02.2007 20:49:06 von Michele Dondi

On Tue, 6 Feb 2007 17:30:40 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>What is
> $_.=

(Please quote some content when replying, it can be hard to follow the
conversation otherwise.)

>? Concatenate what follows to a new line immediately after the current?

Ask

perldoc perlop

For once we can explain you: a single dot is the concatenation
operator. The .= operator is such that

$x .= $y;

has the same semantic as

$x = $x . $y;

>Is it possible the equal sign is redundant?

In the code you originally posted at
? What happened when you tried?

However it is redundant in the sense that omitting it would make for
valid syntax. But the program would do something different.

>Many thanks. I made a bit of progress. At least it doesn't bomb!

?!?

>Using DOS GNU v4. I had to use " " to enclose the expression.
>And change the internal "" to `` not ''.

?!?

>But I'm getting a no-op. Is it possible it resets $. for every line?

No, $. is checked but untouched. Maybe you have a quoting problem.
Under *NIX shells it's easier to quote oneliners with single quotes.
Under command.com and cmd.exe one would better use double ones. For
"internal" strings you can use alternate delimiters.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 06.02.2007 20:49:06 von Michele Dondi

On Tue, 6 Feb 2007 17:30:40 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>What is
> $_.=

(Please quote some content when replying, it can be hard to follow the
conversation otherwise.)

>? Concatenate what follows to a new line immediately after the current?

Ask

perldoc perlop

For once we can explain you: a single dot is the concatenation
operator. The .= operator is such that

$x .= $y;

has the same semantic as

$x = $x . $y;

>Is it possible the equal sign is redundant?

In the code you originally posted at
? What happened when you tried?

However it is redundant in the sense that omitting it would make for
valid syntax. But the program would do something different.

>Many thanks. I made a bit of progress. At least it doesn't bomb!

?!?

>Using DOS GNU v4. I had to use " " to enclose the expression.
>And change the internal "" to `` not ''.

?!?

>But I'm getting a no-op. Is it possible it resets $. for every line?

No, $. is checked but untouched. Maybe you have a quoting problem.
Under *NIX shells it's easier to quote oneliners with single quotes.
Under command.com and cmd.exe one would better use double ones. For
"internal" strings you can use alternate delimiters.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 07.02.2007 08:42:33 von vjp2.at

First thanks for all the help and for putting up with me.

Here's how I think this is supposed to work:
If the line number mod 4 is two, add a spacer of hyphens,
Every fourth line should be spaced by equal signs
the thing should be double spaced.
(I am using fold, but it would be cool if perl did justification)

I tried moving it to my Unix Shell ISP. Here's what I got

Both DOS and Bash do this "command not found".
I don't understand, does perl try to act like a bat/cmd/sh file?

perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=` x 37} else {$_.=`\n`}" junk.tmp

-bash:
: command not found
-bash: -: command not found
-bash: =: command not found
-bash: n: command not found
syntax error at -e line 1, near "{
.="
Number found where operator expected at -e line 1, near "x 37"
(Do you need to predeclare x?)
Number found where operator expected at -e line 1, near "x 37"
(Do you need to predeclare x?)
Execution of -e aborted due to compilation errors.
-bash:
: command not found
-bash:
: command not found
-bash:
: command not found
bash-3.00$


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 07.02.2007 08:42:33 von vjp2.at

First thanks for all the help and for putting up with me.

Here's how I think this is supposed to work:
If the line number mod 4 is two, add a spacer of hyphens,
Every fourth line should be spaced by equal signs
the thing should be double spaced.
(I am using fold, but it would be cool if perl did justification)

I tried moving it to my Unix Shell ISP. Here's what I got

Both DOS and Bash do this "command not found".
I don't understand, does perl try to act like a bat/cmd/sh file?

perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=` x 37} else {$_.=`\n`}" junk.tmp

-bash:
: command not found
-bash: -: command not found
-bash: =: command not found
-bash: n: command not found
syntax error at -e line 1, near "{
.="
Number found where operator expected at -e line 1, near "x 37"
(Do you need to predeclare x?)
Number found where operator expected at -e line 1, near "x 37"
(Do you need to predeclare x?)
Execution of -e aborted due to compilation errors.
-bash:
: command not found
-bash:
: command not found
-bash:
: command not found
bash-3.00$


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 07.02.2007 10:58:14 von anno4000

wrote in comp.lang.perl.misc:
> First thanks for all the help and for putting up with me.
>
> Here's how I think this is supposed to work:
> If the line number mod 4 is two, add a spacer of hyphens,
> Every fourth line should be spaced by equal signs
> the thing should be double spaced.
> (I am using fold, but it would be cool if perl did justification)
>
> I tried moving it to my Unix Shell ISP. Here's what I got
>
> Both DOS and Bash do this "command not found".
> I don't understand, does perl try to act like a bat/cmd/sh file?
>
> perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=`
> x 37} else {$_.=`\n`}" junk.tmp
>
> -bash:
: command not found
> -bash: -: command not found

[etc.]

Sure. You're have messed up your quotes royally, at least for a Unix
shell.

The outer quotes around the Perl program should be single quotes.
The inner quotes should all be double quotes. The backticks are
entirely wrong.

Anno

Re: Stick Lines and Dividers Between Text

am 07.02.2007 10:58:14 von anno4000

wrote in comp.lang.perl.misc:
> First thanks for all the help and for putting up with me.
>
> Here's how I think this is supposed to work:
> If the line number mod 4 is two, add a spacer of hyphens,
> Every fourth line should be spaced by equal signs
> the thing should be double spaced.
> (I am using fold, but it would be cool if perl did justification)
>
> I tried moving it to my Unix Shell ISP. Here's what I got
>
> Both DOS and Bash do this "command not found".
> I don't understand, does perl try to act like a bat/cmd/sh file?
>
> perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=`
> x 37} else {$_.=`\n`}" junk.tmp
>
> -bash:
: command not found
> -bash: -: command not found

[etc.]

Sure. You're have messed up your quotes royally, at least for a Unix
shell.

The outer quotes around the Perl program should be single quotes.
The inner quotes should all be double quotes. The backticks are
entirely wrong.

Anno

Re: Stick Lines and Dividers Between Text

am 07.02.2007 14:23:38 von vjp2.at

Many thanks. Did that. Only message I get now is three "command not found"





- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 07.02.2007 14:23:38 von vjp2.at

Many thanks. Did that. Only message I get now is three "command not found"





- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 07.02.2007 14:45:37 von anno4000

wrote in comp.lang.perl.misc:
>
> Many thanks. Did that. Only message I get now is three "command not found"

Did what? Please quote some context with your reply. Not everyone
has the article you're replying to in view.

Either you don't have a Unix shell or you didn't do what I told you.
What is the exact text of your perl call now?

Anno

Re: Stick Lines and Dividers Between Text

am 07.02.2007 14:45:37 von anno4000

wrote in comp.lang.perl.misc:
>
> Many thanks. Did that. Only message I get now is three "command not found"

Did what? Please quote some context with your reply. Not everyone
has the article you're replying to in view.

Either you don't have a Unix shell or you didn't do what I told you.
What is the exact text of your perl call now?

Anno

Re: Stick Lines and Dividers Between Text

am 07.02.2007 22:26:24 von Joe Smith

vjp2.at@at.BioStrategist.dot.dot.com wrote:
> What is
> $_.=
> ? Concatenate what follows to a new line immediately after the current?

You mean you don't know what
$_ = "foo";
$_ .= "bar";
print $_;
does? If so, you really really need to read and understand 'perldoc perlop'.

> Is it possible the equal sign is redundant?

Absolutely not.

> Many thanks. I made a bit of progress. At least it doesn't bomb!
>
> Using DOS GNU v4. I had to use " " to enclose the expression.

MS-DOS and Unix have different quoting conventions.
Don't try to use the same command line format for both, it does not work.

I run cygwin (www.cygwin.com) on my Windows XP machine so that I
can use bash there, the same as Unix.

> And change the internal "" to `` not ''.

Don't try that with bash. Changing "" to `` WILL NOT WORK!

bash% perl -e 'print `date` x 3;'

> But I'm getting a no-op. Is it possible it resets $. for every line?

No, you have got some other misunderstanding.

I notice that you have not posted
a) the actual code you're trying to run on DOS, and
b) the actual code you're trying to run with bash on Unix.

The other message you posted (Wed, 7 Feb 2007 13:23:38 +0000 (UTC))
is particularly lacking in details.

-Joe

Re: Stick Lines and Dividers Between Text

am 07.02.2007 22:26:24 von Joe Smith

vjp2.at@at.BioStrategist.dot.dot.com wrote:
> What is
> $_.=
> ? Concatenate what follows to a new line immediately after the current?

You mean you don't know what
$_ = "foo";
$_ .= "bar";
print $_;
does? If so, you really really need to read and understand 'perldoc perlop'.

> Is it possible the equal sign is redundant?

Absolutely not.

> Many thanks. I made a bit of progress. At least it doesn't bomb!
>
> Using DOS GNU v4. I had to use " " to enclose the expression.

MS-DOS and Unix have different quoting conventions.
Don't try to use the same command line format for both, it does not work.

I run cygwin (www.cygwin.com) on my Windows XP machine so that I
can use bash there, the same as Unix.

> And change the internal "" to `` not ''.

Don't try that with bash. Changing "" to `` WILL NOT WORK!

bash% perl -e 'print `date` x 3;'

> But I'm getting a no-op. Is it possible it resets $. for every line?

No, you have got some other misunderstanding.

I notice that you have not posted
a) the actual code you're trying to run on DOS, and
b) the actual code you're trying to run with bash on Unix.

The other message you posted (Wed, 7 Feb 2007 13:23:38 +0000 (UTC))
is particularly lacking in details.

-Joe

Re: Stick Lines and Dividers Between Text

am 07.02.2007 22:35:47 von Joe Smith

Michele Dondi wrote:
> For "internal" strings you can use alternate delimiters.

Don't forget to mention alternate quoting syntax: q() and qq().

$_ .= qq(\n) . q(-) x 37;

Re: Stick Lines and Dividers Between Text

am 07.02.2007 22:35:47 von Joe Smith

Michele Dondi wrote:
> For "internal" strings you can use alternate delimiters.

Don't forget to mention alternate quoting syntax: q() and qq().

$_ .= qq(\n) . q(-) x 37;

Re: Stick Lines and Dividers Between Text

am 08.02.2007 13:32:03 von vjp2.at

(0) Ok, back up to the beginning (thanks,sorry).

tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS

both cases it stood there waiting for further input

I hit ^D in Unix and ^Z in DOS and it just went to the shell prompt.

(1) This is what I ran on Unix

perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp

and what I got was "command not found" three times.

(It seem like it is sending output to the shell as commands?)

(2) I was familiar with += form other languages but when I saw $_.= I thought
$_. and = , not $_ and .=

(3) Eventually I want to reformat the paragraphs to 37 characters wide
(looking for code to borrow) so I will probably not keep this as a one-liner.

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 13:32:03 von vjp2.at

(0) Ok, back up to the beginning (thanks,sorry).

tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS

both cases it stood there waiting for further input

I hit ^D in Unix and ^Z in DOS and it just went to the shell prompt.

(1) This is what I ran on Unix

perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp

and what I got was "command not found" three times.

(It seem like it is sending output to the shell as commands?)

(2) I was familiar with += form other languages but when I saw $_.= I thought
$_. and = , not $_ and .=

(3) Eventually I want to reformat the paragraphs to 37 characters wide
(looking for code to borrow) so I will probably not keep this as a one-liner.

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 14:41:33 von vjp2.at

# - This worked as a perl program just fine
# I still have no idea why the command line didn't
# - what are the relevant perl/bin top line commands?
# I took something from a sample and it didn't like it
# - I want to make this a "routine" with the 37 being a parameter.
# - is wrap a standard function in perl? v4 and v5?
# Would I be able to wrap the whole file at 37 cols
# then insert the separators.

while (<>) {
if ($.%4==2) {$_ .= qq(\n).(q(-) x 37).qq(\n)}
elsif ($.%4==0) {$_ .= qq(\n).(q(=) x 37).qq(\n)}
else {$_ .= qq(\n)}
print;
} continue { close ARGV if eof }

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 14:41:33 von vjp2.at

# - This worked as a perl program just fine
# I still have no idea why the command line didn't
# - what are the relevant perl/bin top line commands?
# I took something from a sample and it didn't like it
# - I want to make this a "routine" with the 37 being a parameter.
# - is wrap a standard function in perl? v4 and v5?
# Would I be able to wrap the whole file at 37 cols
# then insert the separators.

while (<>) {
if ($.%4==2) {$_ .= qq(\n).(q(-) x 37).qq(\n)}
elsif ($.%4==0) {$_ .= qq(\n).(q(=) x 37).qq(\n)}
else {$_ .= qq(\n)}
print;
} continue { close ARGV if eof }

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:11:04 von Ian Wilson

vjp2.at@at.BioStrategist.dot.dot.com wrote:
> (0) Ok, back up to the beginning (thanks,sorry).
>
> tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS

The -p option makes perl read from STDIN if no filenames are specified.
Read perldoc perlrun

In the second example (DOS) remember that single quotes don't
interpolate variables and don't substitute meta characters like \n.


> both cases it stood there waiting for further input

Because you used the -p option and didn't supply a filename?


> This is what I ran on Unix
>
> perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
>
> and what I got was "command not found" three times.

I didn't.

$ perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .=
qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
aaa

bbb

-------------------------------------ccc

ddd

=====================================eee

fff

-------------------------------------ggg

hhh

=====================================iii

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:11:04 von Ian Wilson

vjp2.at@at.BioStrategist.dot.dot.com wrote:
> (0) Ok, back up to the beginning (thanks,sorry).
>
> tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS

The -p option makes perl read from STDIN if no filenames are specified.
Read perldoc perlrun

In the second example (DOS) remember that single quotes don't
interpolate variables and don't substitute meta characters like \n.


> both cases it stood there waiting for further input

Because you used the -p option and didn't supply a filename?


> This is what I ran on Unix
>
> perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
>
> and what I got was "command not found" three times.

I didn't.

$ perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .=
qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
aaa

bbb

-------------------------------------ccc

ddd

=====================================eee

fff

-------------------------------------ggg

hhh

=====================================iii

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:32:49 von vjp2.at

Many thanks, still a mystery. But i got it to run it from a file.


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:32:49 von vjp2.at

Many thanks, still a mystery. But i got it to run it from a file.


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:36:46 von vjp2.at

In <45cb2f7a$0$28985$da0feed9@news.zen.co.uk> by Ian Wilson on Thu, 08 Feb 2007 14:11:04 +0000 we perused:


*+-Because you used the -p option and didn't supply a filename?

Wait! How many filenames? In & out or only in?
What if out should be the terminal?


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:36:46 von vjp2.at

In <45cb2f7a$0$28985$da0feed9@news.zen.co.uk> by Ian Wilson on Thu, 08 Feb 2007 14:11:04 +0000 we perused:


*+-Because you used the -p option and didn't supply a filename?

Wait! How many filenames? In & out or only in?
What if out should be the terminal?


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:59:31 von Michele Dondi

On Wed, 7 Feb 2007 07:42:33 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>First thanks for all the help and for putting up with me.

Yes, but then *please* quote some context when replying. Otherwise you
make the discussion hard to follow.

>Here's how I think this is supposed to work:

"this" what? [...]

>If the line number mod 4 is two, add a spacer of hyphens,
>Every fourth line should be spaced by equal signs
>the thing should be double spaced.

[...] If you refer to the first oneliner you posted in this script,
that is:

: perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
^
^

then the answer is yes. Apart that the underlined curly above should
really be a paren, and that "elseif" should be spelled "elsif". Said
this, it would take an input like

aaaa
bbbb
cccc
dddd
eeee
ffff
gggg
hhhh
iiii

and make it into

aaaa

bbbb
-------------------------------------
cccc

dddd
=====================================
eeee

ffff
-------------------------------------
gggg

hhhh
=====================================
iiii

(Everything indented two spaces here.)

>(I am using fold, but it would be cool if perl did justification)

What is fold? And would it mean for perl to "do justification"?
Perhaps you're after Text::Wrap or some similar module?

>Both DOS and Bash do this "command not found".
>I don't understand, does perl try to act like a bat/cmd/sh file?

No, unless you explicitly tell it to do so.

>perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=` x 37} else {$_.=`\n`}" junk.tmp

What does make you think that backticks are just another type of
quote? What does make you think that you can just try various kind of
quotes in a random fashion and expect it to work? Look for qx in

perldoc perlop

BTW: '\n' is a string consisting of a backslash followed by the letter
"n". It's *not* a newline.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 15:59:31 von Michele Dondi

On Wed, 7 Feb 2007 07:42:33 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>First thanks for all the help and for putting up with me.

Yes, but then *please* quote some context when replying. Otherwise you
make the discussion hard to follow.

>Here's how I think this is supposed to work:

"this" what? [...]

>If the line number mod 4 is two, add a spacer of hyphens,
>Every fourth line should be spaced by equal signs
>the thing should be double spaced.

[...] If you refer to the first oneliner you posted in this script,
that is:

: perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
^
^

then the answer is yes. Apart that the underlined curly above should
really be a paren, and that "elseif" should be spelled "elsif". Said
this, it would take an input like

aaaa
bbbb
cccc
dddd
eeee
ffff
gggg
hhhh
iiii

and make it into

aaaa

bbbb
-------------------------------------
cccc

dddd
=====================================
eeee

ffff
-------------------------------------
gggg

hhhh
=====================================
iiii

(Everything indented two spaces here.)

>(I am using fold, but it would be cool if perl did justification)

What is fold? And would it mean for perl to "do justification"?
Perhaps you're after Text::Wrap or some similar module?

>Both DOS and Bash do this "command not found".
>I don't understand, does perl try to act like a bat/cmd/sh file?

No, unless you explicitly tell it to do so.

>perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=` x 37} else {$_.=`\n`}" junk.tmp

What does make you think that backticks are just another type of
quote? What does make you think that you can just try various kind of
quotes in a random fashion and expect it to work? Look for qx in

perldoc perlop

BTW: '\n' is a string consisting of a backslash followed by the letter
"n". It's *not* a newline.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:06:21 von Michele Dondi

On Wed, 7 Feb 2007 13:23:38 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>Many thanks. Did that. Only message I get now is three "command not found"

Please quote some content when replying, as you've been repeatedly
asked to do. However in your previous example the three "command not
found" errors were certainly due to the backticks. Had you *really*
done what Anno suggested you, i.e. not using them altogether, they
should by all means disappear.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:06:21 von Michele Dondi

On Wed, 7 Feb 2007 13:23:38 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>Many thanks. Did that. Only message I get now is three "command not found"

Please quote some content when replying, as you've been repeatedly
asked to do. However in your previous example the three "command not
found" errors were certainly due to the backticks. Had you *really*
done what Anno suggested you, i.e. not using them altogether, they
should by all means disappear.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:12:12 von Michele Dondi

On Thu, 8 Feb 2007 12:32:03 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>(0) Ok, back up to the beginning (thanks,sorry).

Of what?!? *P-L-E-A-S-E* quote something of the message you reply to!!

>tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS
>
>both cases it stood there waiting for further input

That's to be expected. That's what -p does. It "adds something" around
you code. Just see for yourself:

perl -MO=Deparse, -pe ""

>(1) This is what I ran on Unix
>
>perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
>
>and what I got was "command not found" three times.

I don't. And I don't see any reason why I should.

>(2) I was familiar with += form other languages but when I saw $_.= I thought
>$_. and = , not $_ and .=

Yet there are many others as well, as you can clearly see in

perldoc perlop

>(3) Eventually I want to reformat the paragraphs to 37 characters wide
>(looking for code to borrow) so I will probably not keep this as a one-liner.

You may consider giving a peek into Text::Wrap, as hinted in my other
post.

> - = -

Can you please use a standard .sig delimiter, so that a compliant
client will strip it duly?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:12:12 von Michele Dondi

On Thu, 8 Feb 2007 12:32:03 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>(0) Ok, back up to the beginning (thanks,sorry).

Of what?!? *P-L-E-A-S-E* quote something of the message you reply to!!

>tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS
>
>both cases it stood there waiting for further input

That's to be expected. That's what -p does. It "adds something" around
you code. Just see for yourself:

perl -MO=Deparse, -pe ""

>(1) This is what I ran on Unix
>
>perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
>
>and what I got was "command not found" three times.

I don't. And I don't see any reason why I should.

>(2) I was familiar with += form other languages but when I saw $_.= I thought
>$_. and = , not $_ and .=

Yet there are many others as well, as you can clearly see in

perldoc perlop

>(3) Eventually I want to reformat the paragraphs to 37 characters wide
>(looking for code to borrow) so I will probably not keep this as a one-liner.

You may consider giving a peek into Text::Wrap, as hinted in my other
post.

> - = -

Can you please use a standard .sig delimiter, so that a compliant
client will strip it duly?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:16:03 von Michele Dondi

On Wed, 07 Feb 2007 13:35:47 -0800, Joe Smith wrote:

>> For "internal" strings you can use alternate delimiters.
>
>Don't forget to mention alternate quoting syntax: q() and qq().
>
> $_ .= qq(\n) . q(-) x 37;

Well, all this thread is much in a "spoon feed me" fashion. And I
tried to point the OP to the documentation repeatedly, so as to
*encourage* him/her to RTFM rather than blindily asking here.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:16:03 von Michele Dondi

On Wed, 07 Feb 2007 13:35:47 -0800, Joe Smith wrote:

>> For "internal" strings you can use alternate delimiters.
>
>Don't forget to mention alternate quoting syntax: q() and qq().
>
> $_ .= qq(\n) . q(-) x 37;

Well, all this thread is much in a "spoon feed me" fashion. And I
tried to point the OP to the documentation repeatedly, so as to
*encourage* him/her to RTFM rather than blindily asking here.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:24:24 von Michele Dondi

On Thu, 8 Feb 2007 13:41:33 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

># - This worked as a perl program just fine
># I still have no idea why the command line didn't

Hard to say without seeing the actual command line one.

># - what are the relevant perl/bin top line commands?

Huh?!? Are you referring to the shebang line? That is usually

#!/usr/bin/perl

or

#!/usr/bin/env perl

># I took something from a sample and it didn't like it

What didn't like what?

># - I want to make this a "routine" with the 37 being a parameter.

Read

perldoc perlsub

Then wrap around your code below a sub passing a $length parameter
(and possibly a filehandle one as well, instead of having to use ARGV)
and proceed from there.

># - is wrap a standard function in perl? v4 and v5?

perldoc -f wrap

># Would I be able to wrap the whole file at 37 cols
># then insert the separators.

Is this a question? If so, then the answer is: it only depends on your
programming skills. As already suggested you may either use Text::Wrap
or, if for some reason it doesn't suit your needs, hack away its code.

> while (<>) {
> if ($.%4==2) {$_ .= qq(\n).(q(-) x 37).qq(\n)}
> elsif ($.%4==0) {$_ .= qq(\n).(q(=) x 37).qq(\n)}
> else {$_ .= qq(\n)}
> print;
> } continue { close ARGV if eof }

(Code left here since I refer to it above.)


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:24:24 von Michele Dondi

On Thu, 8 Feb 2007 13:41:33 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

># - This worked as a perl program just fine
># I still have no idea why the command line didn't

Hard to say without seeing the actual command line one.

># - what are the relevant perl/bin top line commands?

Huh?!? Are you referring to the shebang line? That is usually

#!/usr/bin/perl

or

#!/usr/bin/env perl

># I took something from a sample and it didn't like it

What didn't like what?

># - I want to make this a "routine" with the 37 being a parameter.

Read

perldoc perlsub

Then wrap around your code below a sub passing a $length parameter
(and possibly a filehandle one as well, instead of having to use ARGV)
and proceed from there.

># - is wrap a standard function in perl? v4 and v5?

perldoc -f wrap

># Would I be able to wrap the whole file at 37 cols
># then insert the separators.

Is this a question? If so, then the answer is: it only depends on your
programming skills. As already suggested you may either use Text::Wrap
or, if for some reason it doesn't suit your needs, hack away its code.

> while (<>) {
> if ($.%4==2) {$_ .= qq(\n).(q(-) x 37).qq(\n)}
> elsif ($.%4==0) {$_ .= qq(\n).(q(=) x 37).qq(\n)}
> else {$_ .= qq(\n)}
> print;
> } continue { close ARGV if eof }

(Code left here since I refer to it above.)


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:44:37 von vjp2.at

*+-Huh?!? Are you referring to the shebang line? That is usually

*+- #!/usr/bin/perl

Yeah, thanks.. the one I copied had switches on it, I guess

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 16:44:37 von vjp2.at

*+-Huh?!? Are you referring to the shebang line? That is usually

*+- #!/usr/bin/perl

Yeah, thanks.. the one I copied had switches on it, I guess

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 08.02.2007 19:27:44 von Joe Smith

vjp2.at@at.BioStrategist.dot.dot.com wrote:
> In <45cb2f7a$0$28985$da0feed9@news.zen.co.uk> by Ian Wilson on Thu, 08 Feb 2007 14:11:04 +0000 we perused:
> *+-Because you used the -p option and didn't supply a filename?
>
> Wait! How many filenames? In & out or only in?

You can discover the answer to that question yourself by reading the docs.
As many as you want (zero names = read from STDIN).
In only.

> What if out should be the terminal?

The -p option does not change where STDOUT goes.

Re: Stick Lines and Dividers Between Text

am 08.02.2007 19:27:44 von Joe Smith

vjp2.at@at.BioStrategist.dot.dot.com wrote:
> In <45cb2f7a$0$28985$da0feed9@news.zen.co.uk> by Ian Wilson on Thu, 08 Feb 2007 14:11:04 +0000 we perused:
> *+-Because you used the -p option and didn't supply a filename?
>
> Wait! How many filenames? In & out or only in?

You can discover the answer to that question yourself by reading the docs.
As many as you want (zero names = read from STDIN).
In only.

> What if out should be the terminal?

The -p option does not change where STDOUT goes.

Re: Stick Lines and Dividers Between Text

am 08.02.2007 23:27:39 von Michele Dondi

On Thu, 8 Feb 2007 15:44:37 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>*+-Huh?!? Are you referring to the shebang line? That is usually
>
>*+- #!/usr/bin/perl
>
>Yeah, thanks.. the one I copied had switches on it, I guess

Then just see what those switches mean and do not copy them blindily.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 23:27:39 von Michele Dondi

On Thu, 8 Feb 2007 15:44:37 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>*+-Huh?!? Are you referring to the shebang line? That is usually
>
>*+- #!/usr/bin/perl
>
>Yeah, thanks.. the one I copied had switches on it, I guess

Then just see what those switches mean and do not copy them blindily.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 23:27:43 von Michele Dondi

On Thu, 8 Feb 2007 14:36:46 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>Wait! How many filenames? In & out or only in?

Just as many as you like. Or none. In which case your program will
wait to read from STDIN.

>What if out should be the terminal?

Huh?!?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 08.02.2007 23:27:43 von Michele Dondi

On Thu, 8 Feb 2007 14:36:46 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>Wait! How many filenames? In & out or only in?

Just as many as you like. Or none. In which case your program will
wait to read from STDIN.

>What if out should be the terminal?

Huh?!?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 09.02.2007 02:21:55 von Tad McClellan

Michele Dondi wrote:
> On Wed, 7 Feb 2007 07:42:33 +0000 (UTC),
> vjp2.at@at.BioStrategist.dot.dot.com wrote:


>: perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
> ^
> ^
>
> Apart that the underlined curly above should
> really be a paren, and that "elseif" should be spelled "elsif".


All of that was pointed out to this poster 4 months ago when he
posted this exact same code...

Message-Id:


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Re: Stick Lines and Dividers Between Text

am 09.02.2007 13:03:47 von vjp2.at

BTW, my main problem was DOS-UNIX cr/lf.. stay tuned


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 09.02.2007 13:03:47 von vjp2.at

BTW, my main problem was DOS-UNIX cr/lf.. stay tuned


- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos]

Re: Stick Lines and Dividers Between Text

am 09.02.2007 15:04:14 von Michele Dondi

On Thu, 8 Feb 2007 19:21:55 -0600, Tad McClellan
wrote:

>All of that was pointed out to this poster 4 months ago when he
>posted this exact same code...
>
>Message-Id:

It's not on my newsserver, but I could find it on GG. Indeed at least
there one could understand the reason why he was asking whether it
were 'x' or '*'.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 09.02.2007 15:09:09 von Michele Dondi

On Fri, 9 Feb 2007 12:03:47 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>BTW, my main problem was DOS-UNIX cr/lf.. stay tuned
>
>
> - = -

Personally I've tried to be helpful as much and as long as possible.
But, also in view of Tad's pointing out that you posted the very same
question 4 months ago, due to your repeated refusal to quote properly
and to use a proper .sig separator, I think I'm gonna killfile you.


PS: you don't even mind specifying whether the problem you had with
line endings was in the source or had to do with the file(s) you're
processing.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: Stick Lines and Dividers Between Text

am 09.02.2007 15:09:09 von Michele Dondi

On Fri, 9 Feb 2007 12:03:47 +0000 (UTC),
vjp2.at@at.BioStrategist.dot.dot.com wrote:

>BTW, my main problem was DOS-UNIX cr/lf.. stay tuned
>
>
> - = -

Personally I've tried to be helpful as much and as long as possible.
But, also in view of Tad's pointing out that you posted the very same
question 4 months ago, due to your repeated refusal to quote properly
and to use a proper .sig separator, I think I'm gonna killfile you.


PS: you don't even mind specifying whether the problem you had with
line endings was in the source or had to do with the file(s) you're
processing.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,