Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Perl gods: Help needed



Joshua Pollak writes:

> What's the best way to do this?
    
This comes to mind:
    
    #!/usr/bin/perl
    
    use strict;
    
    my ($line);
    
    while (defined($line = <>)) {
      chomp;
      if ($line =~ s/\\$//) {
        $line .= <>;
        redo unless eof; 
      }
    
      if ($line =~ /^\s*OPTION\s*=\s*(.*)$/s) {
        my (@options) = split(/\s+/, $1);
        # do something with @options
        for my $option (@options) {
          print "option is $option\n";
        }
        exit;  # Joshua said that he wanted to stop reading here
      }
    }

Hope this helps,

--kevin
-- 
Kevin D. Clark (cetaceannetworks.com!kclark)  |   Will hack Perl for
Cetacean Networks, Inc.                       |  fine food, good beer,
Portsmouth, N.H. (USA)                        |       or fun.
alumni.unh.edu!kdc  (GnuPG ID: B280F24E))     |







BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org