I don't know about you guys, but to me, the less typing the better. That's why i have put together this simple module to automate slurp. I'm sure there is already something like this out there, but I'm new to Perl and through you guys might enjoy it!
#!/usr/bin/perl package Slurp; use strict; use warnings; use Carp; { no strict 'refs'; *main::slurp = \&Slurp::slurp; } sub slurp { { local $/; open(my $fh,'<',$_[0]) || croak " Cant open [ $_[0] ] -- ($!) "; $_ = <$fh>; close($fh); return($_); } } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Automated Slurp
by FunkyMonk (Bishop) on Jan 02, 2010 at 17:07 UTC | |
|
Re: Automated Slurp
by ruzam (Curate) on Jan 02, 2010 at 20:33 UTC | |
by afoken (Chancellor) on Jan 03, 2010 at 09:10 UTC | |
by urthwrm (Novice) on Jan 03, 2010 at 00:10 UTC | |
by BrowserUk (Patriarch) on Jan 03, 2010 at 00:31 UTC | |
|
Re: Automated Slurp
by ikegami (Patriarch) on Jan 02, 2010 at 17:15 UTC | |
by mrdvt92 (Acolyte) on Feb 05, 2010 at 04:13 UTC | |
|
Re: Automated Slurp
by eyepopslikeamosquito (Archbishop) on Jan 03, 2010 at 06:32 UTC | |
by Anonymous Monk on Jan 03, 2010 at 06:57 UTC |