Daniel10
(Daniel)
1
Hello,
when I run this simple program:
#!/usr/bin/ruby -w
fh = File.open(“zero”);
fh.each { |d|
arr = d.split (///);
}
on a file with ‘/’ delimited lines, I get this error message:
warning: split (…) interpreted as method call
However, if I run it on the commandline, such as this:
ruby -e ‘fh = File.open(“zero”); fh.each { |d| arr = d.splt (///); }’
I don’t get any errors.
Can someone explain why I see this error?
db
···
–
Feb 6 King George VI of UK dies; his daughter becomes Elizabeth II, 1952
Feb 6 New Zealand Day
Daniel10
(Daniel)
3
ah, thanks much. I thought the parser would just take care of that
without problems.
Daniel
···
On Fri, Feb 07, 2003 at 03:04:39AM +0900, Gavin Sinclair wrote:
On Friday, February 7, 2003, 4:59:38 AM, Daniel wrote:
Can someone explain why I see this error?
There are two answers:
- you asked for it (with the -w flag)
- you wrote “split (…)” instead of “split(…)”
(the ambiguity gives rise to the warning)
Gavin
–
Feb 6 King George VI of UK dies; his daughter becomes Elizabeth II, 1952
Feb 6 New Zealand Day