Current location: Hot Scripts Forums » Programming Languages » Perl » Perl version of file_get_contents

Perl version of file_get_contents

Reply
  #1 (permalink)  
Old
Wannabe Coder
 
Join Date: Apr 2004
Location: Moving
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Perl version of file_get_contents

Hey I'm looking for perl version of php's file_get_contents?
THanks,
Reply With Quote

Featured Marketplace Scripts (view more)

  #2 (permalink)  
Old
New Member
 
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
perl file_get_contents

$path = "c:\\somewhere";
$fn = "filename.txt";
$fp = "$path\\$fn\n";
print "i will read this:$fp";

$tartalom=&file_get_contents($fp);
print "$tartalom\n";

system("pause");

sub file_get_contents{
my $filename = $_[0];
open(INFO, $filename);
@lines = <INFO>;
close(INFO);
my $string = "";
foreach (@lines){
$string .= $_;
}
return $string;
}
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with my largest perl script. Grabbing data from a file. Sunnmann Perl 2 04-23-08 03:27 AM
Perl upload progress bar with these spec: scott2500uk Script Requests 4 03-16-07 04:04 PM
Looking for beta-testers for Perl Editor Luckasoft Perl 0 06-14-05 11:49 AM
Perl FormMail Problem ennanguyen2002 Perl 2 03-09-05 04:47 PM
I need help plz help me! nadavd Windows .NET Programming 1 06-15-04 12:39 PM


All times are GMT -5. The time now is 03:13 PM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.