in reply to Seeking balance from the <> operator
I think the best you can do is use IO::Handle and then call getline on it instead.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use IO::Handle; open my $fh, '<', $0 or die "Can't read myself: $!\n"; my $self = { fhFrom => $fh }; my $fh2 = ${$self}{fhFrom}; my %line_from; chomp( $line_from{var} = <$fh2> ); chomp( $line_from{expr} = <${$self}{fhFrom}> ); chomp( $line_from{graff} = <$$self{fhFrom}> ); chomp( $line_from{getline} = $self->{fhFrom}->getline ); print Dumper \%line_from; __END__ $VAR1 = { 'var' => '#!/usr/bin/perl' 'graff' => 'GLOB(0x504290)', 'getline' => 'use strict;', 'expr' => 'GLOB(0x504290)', };
I don't know the nuts and bolts of it, but once the "stuff" inside <stuff > gets "too complicated", it treats it like glob.
|
|---|