#!/usr/bin/perl -w use strict; use Win32::Clipboard; my $clipboard = Win32::Clipboard(); print "\nText auto-format-clean when copied to the clipboard is active.\n"; print "To exit, CNTL-C out of this window.\n\n\n"; print "Usage\n", '='x75, "\n"; while (1) { $clipboard->WaitForChange(); my $text = $clipboard->GetText(); $text =~ tr/\r//d; $text =~ s/\n{2}/\r/g; $text =~ s/[ \n\t\f]+/ /g; $text =~ s/\s*\r\s*/\r/g; $text =~ s/\r/\r\n/g; $text =~ s/^\s*//; $text =~ s/\s*$//; $clipboard->Set($text); my $now = localtime(); print $now, ' => ', substr($text, 0, 45), "...\n"; } exit;