Skip to content

Instantly share code, notes, and snippets.

@swuecho
Created July 13, 2012 00:51
Show Gist options
  • Select an option

  • Save swuecho/3102084 to your computer and use it in GitHub Desktop.

Select an option

Save swuecho/3102084 to your computer and use it in GitHub Desktop.
simulate the interact function in Haskell
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use autodie;
use Path::Class;
#use Simple::IO;
my $dir = dir("C:\\Users\\echo\\Dropbox\\bioinfo"); # /tmp
my $file = $dir->file("scope.pl");
my $content_proc= sub {
my $contents=shift;
length($contents);
};
# file_in and methods
sub interact_content {
my $file=shift;
my $fun=shift;
my $content = $file->slurp();
say $fun->($content);
}
my @lines = $file->slurp(chomp => 1);
interact_content($file,$content_proc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment