Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

moritz's scratchpad

by moritz (Cardinal)
on Aug 15, 2007 at 18:07 UTC ( #632816=scratchpad: print w/ replies, xml ) Need Help??

For jairly

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @lines; while (<DATA>) { chomp; if (/^>/) { push @lines, $_; } else { $lines[-1] .= $_; } } print Dumper \@lines; __DATA__ >bob 123456789012345678901234567 8901234567890123 >squeaka TTTGGACCCACAACGTACCACAGGTAT SAJFIJEIFIRVNUTR >trumpet TTTTGAGACCCCCACAAAAGGATTTTT ANDANOTHERLINERT >nautilus AGTCAGTCGATCGTACGTATATAACAC CSADJOIASJNEEESA

Allowing a callback to return more than one level

I want to write some kind of text-only menu system, and that defines callbacks which are called for specific input.



use strict; use warnings; use 5.010; my $return_args; sub RETURN { $return_args = [@_]; no warnings 'exiting'; last 'UNIQUELABEL'; } sub menu { UNIQUELABEL: for (@_) { $_->(); } return @{$return_args} if $return_args; }; say menu sub { say 'go on' }, sub { RETURN 'ended' }, sub { 'never called' },
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
As of 2014-12-28 03:50 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (178 votes), past polls