Jeff 'Japhy' Pinyan wrote:
>
> On Oct 8, Dodo said:
>
> >Undefined subroutine &main::fopen called at C:\Inetpub\wwwroot\dg\index.pl
> >line 91.
> >I get the same error for filesize, fclose, explode and include.
>
> That's because none of those are Perl functions.  You need to look at some
> Perl tutorial or beginner's manual so you know what you're doing.
>
> >$fd = fopen('C:\Inetpub\wwwroot\dg\menu.txt',"r");
>
>   open BLAH, "< c:/Inetpub/wwwroot/dg/menu.txt"
>     or die "can't read c:/Inetpub/wwwroot/dg/menu.txt: $!";

  my $fd;
  open $fd, '< c:/Inetpub/wwwroot/dg/menu.txt';

might be a better match? With $fd in place of 'BLAH' in the
rest of the code.

> >$line = fread($fd,filesize("C:\Inetpub\wwwroot\dg\menu.txt"));
>
> That can be done in many ways...
>
>   my $content = join "", <BLAH>;
>   # or
>   my $content;  { local $/; $content = <BLAH>; }
>   # or
>   read(BLAH, my $content, -s BLAH);
>   # etc.

I'm staying faithful to:

  my $content = do {local $/; <$fd>};

:)

> >fclose($fd);
>
>   close BLAH;
>
> >$lines = explode ("%%",$line);
>
>   my @chunks = split /%%/, $content;
>
> >for ($i=0;$i<$line[0];$i++) {$item = $lines[$i+1];
>
> I don't know what to tell you here... Perl has nicer for loops than C, so
> you might want to use a Perl loop.

...but even so it looks like it should work as it is.
What exactly is the problem?

> >include ($strMiddleCell);
>
> You probably want require().
>
> But WHY are you converting a PHP program to Perl?  What's the point?

I guess it's a question from a job interview. They're
waiting to see if he comes back and asks :-D

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to