bill@ssd.harris.com (Bill Leonard) (12/16/89)
Executing the following script on a Harris HCX running CX/UX: #!/usr/bin/perl sub rpt_for_ol { # Print the argument string as many times as there are elements in the # @x array. local($str) = @_ ; foreach $temp (@x) { print(STDOUT $str) ; } } @x = (1, 2, 3, 4) ; $y = " | c s" ; do &rpt_for_ol($y) ; print("\n") ; generates the following output: Unrecognized character \203 ignored at /usr/local/lib/perl/ line 1. Unrecognized character \001 ignored at /usr/local/lib/perl/ line 1. | c s | c s | c s | c s I cannot figure out why I am getting these messages. If I change the foreach to a for loop that indexes array @x, the messages go away. However, a larger script (from whence this small example came) gives dozens of these messages, and changing foreach to for doesn't seem to help. I suspect changing the loop somehow just changes random trash in memory somewhere, but I don't know where or why. Can anyone help? -- Bill Leonard Harris Computer Systems Division 2101 W. Cypress Creek Road Fort Lauderdale, FL 33309 bill@ssd.csd.harris.com or hcx1!bill@uunet.uu.net
piet@cs.ruu.nl (Piet van Oostrum) (12/18/89)
In article <BILL.89Dec15131943@hcx2.ssd.harris.com>, bill@ssd (Bill Leonard) writes:
`Executing the following script on a Harris HCX running CX/UX:
`
`#!/usr/bin/perl
`
`sub rpt_for_ol {
` # Print the argument string as many times as there are elements in the
` # @x array.
` local($str) = @_ ;
` foreach $temp (@x) {
` print(STDOUT $str) ;
` }
`}
`@x = (1, 2, 3, 4) ;
`$y = " | c s" ;
`do &rpt_for_ol($y) ;
You probably mean either:
do rpt_for_ol($y) ;
or
&rpt_for_ol($y) ;
`print("\n") ;
`
What you are doing now is executing the file whose name is returned by
rpt_for_ol($y) or something similar. I suppose it returns some bogus stuff
(e.g. an empty string)
--
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31-30-531806 Uucp: uunet!mcsun!hp4nl!ruuinf!piet
Telefax: +31-30-513791 Internet: piet@cs.ruu.nl (*`Pete')