Index: /trunk/BNC/scripts/Common.pm
===================================================================
--- /trunk/BNC/scripts/Common.pm	(revision 10511)
+++ /trunk/BNC/scripts/Common.pm	(revision 10512)
@@ -15,4 +15,5 @@
 use File::Basename;
 use File::Spec::Functions;
+use Proc::ProcessTable;
 
 #$| = 1; # Buffer off (print)
@@ -102,4 +103,39 @@
 }
 
+# blurt opens a new file, prints the data in $data to it and closes the file.
+# If $options->{append} is set to a true value, data will be appended to the file. Default is false, existing files will be overwritten.
+#
+# If the string is a Unicode string, use the utf8 option: 'blurt( $unicode_string, $file, {utf8 => 1} );'
+sub blurt {
+    my ( $data, $file, $options ) = @_;
+
+    # legacy signature
+    if ( defined $options and ref $options eq "" ) {
+        $options = { append => 1 };
+    }
+
+    $options = {} unless defined $options;
+
+    local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
+
+    $options->{append} = 0 unless defined $options->{append};
+
+   #_confirm( ( $options->{append} ? "Appending" : "Writing" ) . " " . length ($data) . " bytes to $file" ) or return 1;
+
+    open my $fh, ">" . ( $options->{append} ? ">" : "" ) . $file
+      or LOGCROAK("Cannot open $file for writing ($!)");
+
+    binmode $fh;    # Win32 wants that
+
+    if ( $options->{utf8} ) {
+        binmode $fh, ":utf8";
+    }
+
+    print $fh $data
+      or LOGCROAK("Cannot write to $file ($!)");
+    close $fh
+      or LOGCROAK("Cannot close $file ($!)");
+}
+
 #** @function filePosition ($file, $filePos)
 # @brief Save position of a file in an idxfile.
