Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Probs simple but need help
  • Mr. P-teoMr. P-teo
    Posts: 270
    hy everyone, i need some help with something i belive would be very simple. I need to make an if statement that basically says,
    if $input = nothing then print enter text else print $input.


    I tried the following but doesn't work. Can anyone help?


    if ($input eq NULL){
    print \"\nPlease enter text...\";
    } else {
    print \"$input...\n\n\n\";
    }
    Skype: mrpt3o
    Twitter: MrPteo


    image
  • Sh3llc0d3
    Posts: 1,910
    #!C:\Perl64\bin\perl.exe
    print \"enter text\";
    chomp($input = <>);
    if($input eq '')
    {
    print \"enter something!\n\n\";
    } else {
    print \"bleh\n\n\";
    }


    Here's a better version:

    #!C:\Perl64\bin\perl.exe
    while(1)
    {
    print \"Enter text: \";
    chomp($input = <>);
    if($input eq '')
    {
    print \"Enter something!\n\n\";
    } else {
    print \"You entered $input\n\n\";
    exit;
    }
    }
  • Xin
    Posts: 3,251
    I don't program in perl, but in other languages it isnt

    if value = null


    it is

    if value is null


    Or the equivelent in perl.
    Xin