Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: STDIN usage in interactive debug

by haj (Priest)
on Oct 24, 2021 at 08:16 UTC ( #11137944=note: print w/replies, xml ) Need Help??


in reply to STDIN usage in interactive debug

In the debugger you can either use debugger commands or valid Perl, but <"FILE" is neither.

To get the contents of a file into an array, valid Perl isn't that difficult:

DB<1> open ($in,'<','FILE') DB<2> @ln = <$in> DB<3> close $in

Replies are listed 'Best First'.
Re^2: STDIN usage in interactive debug
by Fletch (Chancellor) on Oct 24, 2021 at 09:06 UTC

    Or you could even do it all in one line (without needing the close). . .

    DB<1> @lines = do { open( my $fh, '<', 'FILE' ); <$fh> }

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137944]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2021-12-02 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (22 votes). Check out past polls.

    Notices?