Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Shortcuts engine for note taking

by munchie (Monk)
on Apr 02, 2002 at 20:42 UTC ( #156108=sourcecode: print w/replies, xml ) Need Help??
Category: Text Processing
Author/Contact Info munchie
Description: This code allows the user to set shortcuts (a character surrounded in brackets) to allow for fast note taking/document writing. (Thank you tilly for the awesome Text::xSV module!)
#! Perl -w
##                                       ## -shortcut maintaining engine#
##                                       ##
use strict;
use Text::xSV;

my $shortcut_file = 'scuts'; #Define file that contains shortcuts
my $output_file = 'sfile'; #Define file for output

########END OF USER INPUT########


sub set_shortcut {
    my $is_taken=0;
    print "Which shortcut character would you like (1 letter!)? (will 
+appear in brackets) ";
    chomp(my $char=<STDIN>);
    print "What text do you want it to print?\n";
    chomp(my $text=<STDIN>);
    my $csv = new Text::xSV;
    while ($csv->get_row()) {
        my ($shortcut) = $csv->extract(qw(shortcut));
        if ($char eq $shortcut) {
            warn "Shortcut character already used!";
    unless ($is_taken) {
        open(SF, ">>$sf");
        print SF "$char,$text\n";
sub get_shortcuts {
    my $csv = new Text::xSV;
    while ($csv->get_row()) {
        my ($shortcut, $output) = $csv->extract(qw(shortcut output));
          print "\{$shortcut\} produces $output\n";
sub new_doc {
    print "Type your note/doc (type {e} on a new line to end):\n";
    open(OF, ">>$of");
    while (my $line = <STDIN>) {
        last if $line =~ /\{e\}/;
        my %shortcuts;
        my $csv = new Text::xSV;
        while ($csv->get_row()) {
            my ($shortcut, $output) = $csv->extract(qw(shortcut output
            $shortcuts{$shortcut} = $output;
        $line =~ s/\{(\w)\}+/$shortcuts{$1}/g;
        print OF $line;
sub get_doc {
    open(OF, "<$of");
    while (<OF>) {
unless (-s $sf) {
    open(SF, ">>$sf");
    print SF "shortcut,output\n";

print "Welcome to S.S.E. \{Steven's Shortcut Engine\}\n";
print "\t{s} to set a shortcut\n\t{o} to view the output file's conten
+ts\n\t{n} to start typing to the output file\n\t{g} to view the short
+cuts you've already made\n";
while(1) {
    print "\%> ";
    chomp(my $choice=<STDIN>);

    if ($choice =~ /\{s\}/) {
    } elsif ($choice =~ /\{n\}/) {
    } elsif ($choice =~ /\{g\}/) {
    } elsif ($choice =~ /\{o\}/) {
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://156108]
[ambrus]: "different specialized employees in different rooms" => so, there's a cleaner guy who cleans up the vomit from the bathroom every morning?
[erix]: makes me think of MMM too (mythical man month): "adding more people to a project makes it slower"
[erix]: that should be "to an already-too-late- project" I think
[ambrus]: oh yes, we have a pretty good example of that when they reorganized the grill place in the restaurant nearby.
[ambrus]: it now has two more people working there, and they're serving slower and more expensive.
[ambrus]: It used to be just a master cook who takes the order and puts the meat and eggs on the open grill plate table, and an assistant who removes them to a plate, adds the side dish, and gives the plate to the people in the queue, plus a cashier.
[ambrus]: Now it has five people instead of three, some sort of call number ticket system where people wait a lot for their food to get ready (it's the same kinds of grilled meat and fish on the same equipment, it won't actually fry slower),
[ambrus]: it's slow as hell, and the food costs significantly more.
[ambrus]: We no longer eat there.
LanX Everybody quotes it, some people read it, and a few people go by it

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2017-09-22 13:49 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (264 votes). Check out past polls.