Just so I understand, you can't:

 ($date, $time, $add1, $add2, $add3, @rest) = split(/\|/); # can you?

>   @f = split(/\|/);   # \| because | is a regexp char, splits $_
> 
>   # grab the bits we want to duplicate for each record. you will have
>   # to tweak for the actual number of fields.  @rest should just
> contain
>   # the numbers
> 
>   ($date, $time, $add1, $add2, $add3, @rest) = @f;
> 
>   foreach $n (@rest)
>   {
>     $n =~ /^\s*$/ && next;    # If the field is blank or space only
>                               # ignore. =~ binds the pattern match
>     print "$date|$time|$add1|$add2|$add3|$n\n";
>   }
> }
> 
> You can make this a bit more efficient but it would have been harder
> to explain and wouldn't include some handy perlisms
> 
> Enjoy, Steve
> 
> Crystal Wrote...
> 
> Hi all,
> 
> I have a problem and I need to know where to begin. At the magazine I
> work
> for we have what are called "bingo cards" in the magazine that people
> can
> fill out and send back to us to get information on whatever of 271
> topics,
> stores, resorts, etc. of their choice. They can also fill this out
> online.
> What we end up with is a DAT file with each users stuff as one entry
> in
> a
> pipe-delimited file with hard returns at the end of each entry. Of
> course we
> could bring this into Excel or Access or some other DB, but the
> problem
> then
> becomes that there are 283 fields. Not many  DB's support that many.
> 
> The point:
> I need to take this text file and format each entry (separated by
> hard
> returns) so that the user info (name address, etc) are all in their
> own
> columns still and then for each number they chose (up to 271 out of
> 271)
> it
> creates a new entry with their contact info and one number in the
> last
> column.
> 
> For example: Joe Smith|123 Main
> St.|Yourtown|US|83124|888-555-1212|[EMAIL PROTECTED]|1|2||||||8||10|11|
> would
> then become:
> Joe Smith|123 Main
> St.|Yourtown|US|83124|888-555-1212|[EMAIL PROTECTED]|1|
> Joe Smith|123 Main
> St.|Yourtown|US|83124|888-555-1212|[EMAIL PROTECTED]|2|
> Joe Smith|123 Main
> St.|Yourtown|US|83124|888-555-1212|[EMAIL PROTECTED]|8|
> Joe Smith|123 Main
> St.|Yourtown|US|83124|888-555-1212|[EMAIL PROTECTED]|10|
> Joe Smith|123 Main
> St.|Yourtown|US|83124|888-555-1212|[EMAIL PROTECTED]|11|
> 
> Here is a sample entry from the DAT file.
> 
> |6/12/2001|13:05:34|Closet Geek|456 Flibity Jibet Way|My
>
Town|CA|90450|US|[EMAIL PROTECTED]|760-555-1212||1|2|3|4|5|6|7|8|9|10
>
|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|
>
36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|6
>
1|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86
>
|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|
>
109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|
>
128|129|130|131|132|133|134|135|136|137|138|139|140|141|142|143|144|145|146|
>
147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|
>
166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|
>
185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|
>
204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|
>
223|224|225|226|227|228|229|230|231|232||234|235|236|237|238|239|240|241|242
>
|243|244|245|246|247|248|249|250|251|252|253|254|255|256|257|258|259|260|261
> |262|263|264|265|266|267|268|269|270|271|
> |6/12/2001|13:14:42|closetgeek|456 Flibity Jibet Way|Yucca
>
Valley|California|54444|yugoslavia|[EMAIL PROTECTED]|760-555-1212|Submit||
>
|||||||||||||||||||||||||||||||||||||||||||||||||||53|||||58||||||||||||||||
>
||||78|||||||||||89||||||95||97|||||||||||||||||||||||||||||||||||||||||||||
>
||||||||||||||||||||||||||168||||||||||178||||||||186|||||||||||197|||||||||
>
|207|||||||||||||||||||||||230||||||||||||||||||||||||||||||||||||||||||
> 
> I really need to know where to begin. Should I put everything between
> the
> first 12 pipes (including the pipes) into a variable and then run a
> loop
> on
> the remainder? 
> 
> Closet Geek >^..^<


=====

---------------------------------
Notice: This e-mail is protected by the U.S. Constitution and the U.N. Declaration of 
Human Rights. Unauthorized interception by any public or private agency is an ugly 
sort of work to be in. Does your mother know you spend your days reading other 
people's mail? Would she be proud of you?

---------------------------------
Please visit: http://clubs.yahoo.com/clubs/district41democrats

__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/

Reply via email to