Hi

If i add the try block it says syntex error at initlialization of for loop .

Non -working code ...

#!/usr/bin/perl -w
use strict;
        try
        {
        print " 11111111111  ";
    }
    catch
    {
        print " 2222222222 ";
    }

    for (my $i = 0 ; $i < 5; $i++)
    {
            print " wwww ";
        }

If i remove the try block it works ... can you please tell me you is it so and how does it work properly ?

Recommended Answers

All 4 Replies

Perl has no such inbuilt functions/operators try and catch.

just add semicolon at the end of the catch block. ;-)))))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.