Hi, Robin.
1st Situation.
I think the problem with " my $incoming = <$self->{filehandle}>; " it's that
Perl thinks that the expresion inside the < > is $self- and then expects a
semicolon but that semicolon isn't there.
2nd Situation.
Do you like this option ?
sub mySub {
$foo = shift; # Scalar
$rarray = shift; # Array reference
$rhash = shift; # Hash reference
@bar = @{$rarray}; # Dereferencing
%baz = %{$rhash}; # Dereferencing
...
}
ByeZ :)
El Wed January 21 2004 01:34 Robin Sheat dijo :
> Hey there, I'm not a total beginner to Perl, but am far enough into it
> to have a lot of questions, so I hope this is a suitable place for them
>
> :)
>
> My current one is this. I have a method:
> sub getResponse {
> my $self = shift;
> my $fh = $self->{filehandle};
> my $incoming = <$fh>;
> ...
>
> This works fine. However, the way I originally wrote it:
> sub getResponse {
> my $self = shift;
> my $incoming = <$self->{filehandle}>;
> ...
> gave me:
> syntax error at NeuralPerl.pm line 50, near "<$self->{"
> Compilation failed in require at ./testlib.pl line 7.
> BEGIN failed--compilation aborted at ./testlib.pl line 7.
> I tried various curly brackets none of which made a difference. It works
> fine the way I have it now, but I'm curious as to why I have to do it
> this way.
>
> Oh, another one that I have hit a few times; is there a nice way of
> doing what this looks like it means:
> sub mySub {
> $foo = shift;
> @bar = shift;
> %baz = shift;
> ...
>
> Currently I use things like @{ $_[1] } and so on, but I'm wondering if
> there is a way I can use shift.
>
> cheers (and hopefully I'll be able to help out a few people in return!:)
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GM/B/CS d- s+:+ a-- C+ UL+++ P++++$ L++ E--- W N-- !o K? w !O !M V-- PS++
PE++ Y PGP+++ t--- 5 X R- tv- b+++ DI- D+ G e h! r+++@ y?
------END GEEK CODE BLOCK------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>