sufi has asked for the wisdom of the Perl Monks concerning the following question:

Hi I new to Perl, I have a problem in using <DATA> file handle in Perl program in windows environment. I want to use data handle(using the data (format: _ _ DATA _ _) from the same script file but it give me an error: Program: while(<DATA>){ print if /Norma/; } _ _DATA_ _ Steve Blenheim Betty Boop Igor Chevsky Norma Cord Error description: Can't locate object method "DeLoach" via package "Karen" (perhaps you forgot to load "Karen"?) at test2.pl line 4.
  • Comment on <DATA> file handle not working with Perl Starwbery 5.12.1

Replies are listed 'Best First'.
Re: <DATA> file handle not working with Perl Starwbery 5.12.1
by Anonymous Monk on Dec 23, 2010 at 05:15 UTC
    What are those extra spaces you got there in __DATA__? Oh, and use <c>code here</c>

      This works fine for me.

      #! perl # use strict; use warnings; while(<DATA>){ print if /Norma/; } __DATA__ Steve Blenheim Betty Boop Igor Chevsky Norma Cord

      Result

      perl "D:\perl_TK\DBperl\perl6data.pl" Process started >>> Norma Cord <<< Process finished.
        Hi Thank you for help Cheers Sufi