Skip to content

Instantly share code, notes, and snippets.

@bxt
Last active November 16, 2016 12:22
Show Gist options
  • Save bxt/4942321 to your computer and use it in GitHub Desktop.
Save bxt/4942321 to your computer and use it in GitHub Desktop.
Some really weird ruby script showing some awkish/sedish features
$/=%q(/)
$\=%Q(\t)
while DATA.gets
BEGIN {puts "START #{$0}"}
END {puts "DONE."}
print
puts $_[/a(.{2})/,1] || '--'
end
__END__
alal2/gg/omglol/la/abcd
@bxt
Copy link
Author

bxt commented Nov 16, 2016

So apparently in recent rubies BEGIN and END are a little more sane, this script now throws an error:

r.rb:5: BEGIN is permitted only at toplevel
  BEGIN {puts "START #{$0}"}
       ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment