Confirmation Bias

View as PDF

Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Perl, Ruby

I am sure you have all seen

As it turns out, you can write programs that do the same!

Your challenge is to write a program that runs as both Perl and Ruby, and as Perl, it will print the string This is a Perl program., while as Ruby, it will print This is a Ruby program.

Input Specification

There is no input.

Output Specification

When run as Perl:

This is a Perl program.

When run as Ruby:

This is a Ruby program.

Comments


  • 0
    do_ur_homwork  commented on Dec. 10, 2025, 1:41 a.m. edit 104

    Also shouldn't you find a way to prevent gamblers who randomly generate code(probably by adding test cases)


  • 0
    do_ur_homwork  commented on Dec. 10, 2025, 1:21 a.m.

    This is a Polyglot Script.